sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5f542e1eb4d781e2381ebb152ecfd42d1d814454de9215f54aa893a90c2d9fa8
Python
113,132
2,710
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Base class template for forecaster scitype. class name: BaseForecaster Scitype defining methods: fitting - fit(y, X=None, fh=None) forecasting - predict(fh=None, X=None) updating - update(y, X=None, ...
1b6b57bc34e234f6aa0da0a8745e809d424d2f31edce9159cadef608698436c4
Python
114,426
2,891
# SPDX-License-Identifier: LGPL-3.0-or-later import json import warnings from collections.abc import ( Callable, ) from typing import ( TYPE_CHECKING, Any, Optional, ) import numpy as np import torch from deepmd.dpmodel.model.transform_output import ( communicate_extended_output, ) from deepmd.dpm...
7dae815a67a9451dad5b27b9c2409395629f4c0e1b9138340fca5cb35ae35aff
Python
114,746
2,939
#!/usr/bin/env python __author__ = "pbmanis" """ model_run.py Run a model based on a hoc structure, decorating the structure with ion channels and synapses. Requires: Python 3.7 (anaconda distribution) Neuron7.7 (neuron.yale.edu) pyqtgraph (Campagnola, from github) neuronvis (Campagnola/Manis, from github) cnmodel ...
54b615a1fef4d3b71cfa025a7da57887e1aa1d73fef40e13e3c60f79c4f95c52
Python
114,898
3,268
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import ml_dtypes import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect from onnx.reference.ops.op_attention import _compute_attentio...
ca83ae1720bb6c1be12b146aff4ac2caa094ff8e71aefa23f51f307e6970df27
Python
117,820
3,246
import itertools from functools import partial import warnings import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.colors import same_color, to_rgb, to_rgba import pytest from pytest import approx from numpy.testing import ( assert_array_equal, asser...
c094a205ace50d9b7d3c32f503ce3e1499f0c8c121321b5fac2d7e7c622a6352
Python
119,203
3,163
""" Functions to compute some results and plot the simulation results from model_run2. Reads the new format filenames. This is written as a class with a set of methods that can be called from elsewhere. Typically, these will be called from within DataTablesVCN.py, which provides graphical table-based access to the sim...
b7e8ef739d5708f4d10013e7c951c807d874ba50345fcf8e82a30a3d73350d0a
Python
120,378
2,750
# -*- coding: utf-8 -*- """logger class mainly to be used with `CMAEvolutionStrategy` """ from __future__ import absolute_import, division, print_function, unicode_literals __author__ = "Nikolaus Hansen" import os # path import sys # flush import warnings import time # from collections import defaultdict as _defau...
eff87f0c068cbd2f3f91987234922ce4c85198d1a7f87a48e1a53dc10f97382e
Python
121,231
2,097
import pdb import xarray as xr import numpy as np import pandas as pd import itertools from collections import defaultdict # import src.data.analyse_spikes as anaspikes import sklearn.metrics as sklmetrics import sklearn.linear_model as sklinear def align_single_event(binned_spike_ds, behave_df, event_name, time_...
c5d3c9c0c2fd84827da9ad76d830ffd581469721501ae8f811e529ed20862846
Python
122,179
3,466
from collections import namedtuple from textwrap import dedent import warnings from colorsys import rgb_to_hls from functools import partial import numpy as np import pandas as pd import matplotlib as mpl from matplotlib.cbook import normalize_kwargs from matplotlib.collections import PatchCollection from matplotlib....
3e837258b03fba6016cadd1b229a00bf51f518e317513dec2df28d0a6bfa5940
Python
125,710
3,143
import bisect import copy import logging import re import typing from abc import ABC, abstractmethod from collections import Counter, defaultdict from collections.abc import Iterable from operator import itemgetter from os import PathLike from pathlib import Path from typing import Any, NamedTuple, Optional, Union, cas...
65a9b44f69afe2c6dcd7831c6f5d642c9e8b45fec440508ff2d1f673e7eb9111
Python
126,339
2,295
import numpy as np import pandas as pd import os from pandas.api.types import is_string_dtype,is_numeric_dtype import networkx as nx import seaborn as sns import pylab as plt import matplotlib as mpl import shapely.geometry as geom from copy import deepcopy import itertools from scipy.spatial import distance,cKDTree,KD...
7fe1c4670ee0ad7b3801d9c1bc18c4882d4ad75cb873fe231f5330ab0596dea7
Python
127,331
88
## For Calculating Chlorpromazine Concentration in the ECS from numba import jit import numpy as np #import matplotlib.pyplot as plt from scipy import interpolate import time begin = time.time() h=0.01 # In minutes -- time step size g=0.01 # In Centimeter -- spatial step size print("h=",h) print("g=",g) ...
79da8d6aadac9eddd1a9e07fce250df7a7d4f92b7d4f59614641ef9a6adde62b
Python
127,549
3,120
# SPDX-License-Identifier: LGPL-3.0-or-later import itertools import math import os import unittest from contextlib import ( nullcontext, ) from types import ( SimpleNamespace, ) from unittest import ( mock, ) import torch from deepmd.pt.model.descriptor.sezm import ( DescrptSeZM, ) from deepmd.pt.mod...
0b598693f29c6f1b3fd910caf0b87ace05fec400de27887097bc9387566ada77
Python
127,609
2,004
import pandas as pd from copy import deepcopy from utils.swa_bn_update import update_bn from torch.optim.swa_utils import AveragedModel, SWALR from torch.optim.lr_scheduler import ExponentialLR, StepLR, CosineAnnealingWarmRestarts from tqdm import tqdm import logging import sys logging.getLogger('some_logger') from sp...
c06f742413885b689f16d54300959473feb475b1fd26e55bf997919172f0e46a
Python
128,005
3,250
import io import os import re import json import yaml import types import gzip import zipfile import tempfile import mimetypes import subprocess import idlib import rdflib from inspect import getsourcefile from pathlib import Path, PurePath from itertools import chain from collections import namedtuple from urllib.pars...
c0325f568f4be291919de11e1d02b445268590bac68334938ba40a18a9c318d7
Python
129,465
3,136
# SPDX-License-Identifier: LGPL-3.0-or-later """ SO(2)-equivariant message-passing layers for DPA4/SeZM. This module defines the reduced-layout SO(2) linear operator and the edge convolution used inside SeZM interaction blocks. This module is the dpmodel (array-API) port of ``deepmd.pt.model.descriptor.sezm_nn.so2``....
995f31d341a40b620beb06d4f6e58c1f90a5cc13592b799634fadfe7794b4e14
Python
131,422
2,821
import pdb import numpy as np import pandas as pd from tqdm import tqdm from collections import defaultdict import scipy.ndimage as spimage import scipy.signal as spsignal import scipy.stats as sstats import xarray as xr import pickle as pkl from collections import defaultdict import itertools import os import src.da...
2e06953f2748a6df6c7d85f70e8b91612e5a9cb9dd1c6ec24ba470ad7c0c7e28
Python
131,622
3,102
# SPDX-License-Identifier: LGPL-3.0-or-later """ SO(2)-equivariant message-passing layers for SeZM. This module defines the reduced-layout SO(2) linear operator and the edge convolution used inside SeZM interaction blocks. """ from __future__ import ( annotations, ) import math from typing import ( TYPE_CHEC...
bb7df834de434a9e487add89e1f296b3457cb4f5f98d445abb8228611805f091
Python
133,105
3,064
# SPDX-License-Identifier: LGPL-3.0-or-later """ DPA4/SeZM descriptor: Smooth Equivariant Zone-bridging Model. dpmodel (array-API) backend This implementation is designed around two goals: 1) Conservative forces: the descriptor is computed from differentiable energy. 2) Efficient inference: edge geometry and Wigner-...
c189fb78e96f2e7cbf83d351ac3c4ea903d5b44fc74d01fe06b098f62bdf6d61
Python
133,588
3,090
# SPDX-License-Identifier: LGPL-3.0-or-later """ SeZM descriptor: Smooth Equivariant Zone-bridging Model. PyTorch backend This implementation is designed around two goals: 1) Conservative forces: the descriptor is computed from differentiable energy. 2) Efficient inference: edge geometry and Wigner-D rotation blocks...
f7adb8056b9695d60e3a0b2a19c85858d0ca5a235f82d44bf7dd66ebca160de5
Python
134,509
3,273
# SPDX-License-Identifier: LGPL-3.0-or-later """Unit tests for LmdbDataReader, LmdbTestData, LmdbBatchSampler, etc. Pure dpmodel (NumPy/lmdb) tests — no PyTorch dependency. """ import gc import os import signal import subprocess import sys import tempfile import textwrap import unittest from concurrent.futures import...
a7a833246e62eeb592a51fb993e99a50c6203af947ccc1c1eca9930700b010b6
Python
137,196
3,358
# SPDX-License-Identifier: LGPL-3.0-or-later import contextlib import ctypes import dataclasses import json import logging import os from collections.abc import ( Iterator, ) from typing import ( Any, ) import numpy as np import torch from deepmd.dpmodel.utils.neighbor_graph import ( PME_MESH, flatten...
e2dbab9d27f026722abaa2f2e05e579fddc8ccff6ba50c057f0310d731a44cd7
Python
139,445
3,926
from __future__ import division from textwrap import dedent import colorsys import numpy as np from scipy import stats import pandas as pd import matplotlib as mpl from matplotlib.collections import PatchCollection import matplotlib.patches as Patches import matplotlib.pyplot as plt import warnings from .external.six ...
fe058d6cbadd97b79e24ff976904e08c1f1502ef5140b61a917a793289944bc3
Python
141,076
3,592
# SPDX-License-Identifier: LGPL-3.0-or-later import math import os import tempfile import unittest import warnings from pathlib import ( Path, ) from unittest import ( mock, ) import h5py import numpy as np import torch from packaging.version import parse as parse_version from deepmd.pt.loss import ( DeNS...
8b6a9541f9fdaa89daac290acc6177d739c8b1b28b1a2a7c64dab93a2fa3d17d
Python
144,599
3,250
#!/usr/bin/env python3 """WARNING: DO NOT MODIFY THIS FILE IT IS AUTOMATICALLY GENERATED BY scigraph.py AND WILL BE OVERWRITTEN Swagger Version: 2.0, API Version: 1.0.1 generated for http://localhost:9000/scigraph/swagger.json by scigraph.py """ import re import copy import inspect import builtins from urllib.parse imp...
829028d1effdc4910a28cb9b9e55ce9a3ca264911d39bbc0a5a4e74ef58d230f
Python
147,175
3,429
import numpy as np import scipy.stats as sstats import pandas as pd import xarray as xr import joblib import multiprocessing # from tqdm import tqdm from tqdm.notebook import tqdm from collections import defaultdict import itertools import pdb import src.data.process_ephys_data as pephys import src.data.analyse_spikes...
e337ae3d76e1a6d34ed78b132ce58eb28cdb50be452e089bf2243d2d67fe8d5a
Python
147,305
3,844
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import contextlib import os import struct import tempfile import numpy as np import pytest import onnx.version_converter from onnx import ( GraphProto, ModelProto, OperatorSetIdProto, T...
07c73330b966558991c7b53e4491be6faf748289f635a3174fa3ef6d05b7980e
Python
148,210
3,231
import rdflib from rdflib import URIRef, Literal from pyontutils import combinators as cmb from pyontutils.core import OntId, OntTerm, qname from pyontutils.core import simpleOnt, displayGraph from pyontutils.namespaces import OntCuries, makeNamespaces from pyontutils.namespaces import partOf, hasRole, locatedIn from p...
1023e4467f60d0739f1cf5b435a48a0383f07205795b9ad9c550632008a35d34
Python
148,226
3,231
import rdflib from rdflib import URIRef, Literal from pyontutils import combinators as cmb from pyontutils.core import OntId, OntTerm, qname from pyontutils.core import simpleOnt, displayGraph from pyontutils.namespaces import OntCuries, makeNamespaces from pyontutils.namespaces import partOf, hasRole, locatedIn from p...
07ff55c4fe0d352a2d8d646791caae605d3390efe141be8800c588ad138a5427
Python
148,547
3,673
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
4daee91c2bdad6fbb362d3dc6abb6b05955c88f2461b8fb27acb72fdd1b4fdd3
Python
149,337
3,557
# SPDX-License-Identifier: LGPL-3.0-or-later """SeZM: Smooth equivariant Zone-bridging Model. This module hosts the ``make_fx`` + Inductor pipeline that runs the SeZM energy (``ener``) path on the GPU. To the authors' knowledge this is the first public implementation of a compiled, dynamically shaped machine-learning...
3dcecb2018aa9643cdf28cb09b0c926803460340301af73dbb6e229decb913a4
Python
150,961
3,682
#!/usr/bin/env python3 import os import sys import atexit import inspect import tempfile from pprint import pformat from pathlib import Path, PurePath as PPath from importlib import import_module from collections import defaultdict from urllib.error import HTTPError import git import rdflib import requests import ontqu...
eed13ceb088e81d4c28286c862a6225d7c5e37b0e76c8e332121cbb1dbf90977
Python
151,580
3,753
import io import os import re import json import yaml import types import gzip import zipfile import tempfile import mimetypes import subprocess import idlib import rdflib from inspect import getsourcefile from pathlib import Path, PurePath from itertools import chain from collections import namedtuple, defaultdict fro...
d8946e75bed33c1d68db0eccf21f61223ce56023b56ee06a6feb5e0ddfb3cc89
Python
152,478
4,209
"""figures.py - generate figures for the paper This class generates final figures for the SBEM manuscript by reaching back to the original simulation data, including, in some cases, refitting. Both primary "examplar" figures, and supplemental figures, are generated. The figures are made consistent by using both sns.set...
ddc7f9527319770938105a4968ecc24a416bd7f0eb3a256473188cd52a175fdc
Python
160,874
3,597
import matplotlib.pyplot as plt import numpy as np from src.visualization.useSansMaths import use_sans_maths from src.utils import get_project_root root = get_project_root() import os import glob import pickle as pkl import pandas as pd import src.data.process_ephys_data as pephys import src.data.stat as stat import d...
e7eba27951905dbb59fd71224a7cde44980d86db0a5810918e00f01630ced768
Python
161,899
3,880
# SPDX-License-Identifier: LGPL-3.0-or-later """Training loop for the pt_expt backend. Uses ``DeepmdDataSystem`` (numpy-based batch provider) instead of the pt backend's ``DpLoaderSet`` + ``DataLoader``. NumPy batches are converted to torch tensors at the boundary. """ import functools import logging import time fro...
7b773f43b60a13b64192f8e71fb43ac34d15bbc4dd8be433bd90e27545483106
Python
168,069
3,143
import pdb import pandas as pd import pickle as pkl import numpy as np import os import glob import matplotlib.pyplot as plt import matplotlib as mpl import sciplotlib.style as splstyle from tqdm import tqdm import time import src.data.analyse_spikes as anaspikes import src.data.process_ephys_data as pephys import...
1f33bf8c85f652b0789571db0c386d3a90d2cfc9f0f3013bc61d6a1c63a7d65c
Python
175,970
1,182
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Important Details about EEG data:\n", "Sampple Frequency = 200 Hz\n", "\n", "Number of Samples = 621892\n", "\n", "Duration of trial = 0.85 seconds after onset, which is indicated by firs non-zero marker value f...
e732d589816129f04be7e6e8416392c4acc4925d7ef15b256f332160439a089c
Python
178,467
1,239
regs_per_section ={ 1 : ['fiber tracts', 'OLF'], 2 : ['fiber tracts', 'OLF'], 3 : ['fiber tracts', 'OLF'], 4 : ['fiber tracts', 'OLF', 'MOB'], 5 : ['fiber tracts', 'OLF', 'MOB'], 6 : ['fiber tracts', 'OLF', 'MOB'], 7 : ['fiber tracts', 'OLF', 'MOB'], 8 : ['fiber tracts', 'OLF', 'MOB'], 9 : ['fiber tracts', 'OLF', 'MOB'...
ad53c107114973ae71b849e67960159d78f6d7a17c15966af9dc0162597e50d4
Python
178,470
1,242
regs_per_section ={ 1 : ['fiber tracts', 'OLF'], 2 : ['fiber tracts', 'OLF'], 3 : ['fiber tracts', 'OLF'], 4 : ['fiber tracts', 'OLF', 'MOB'], 5 : ['fiber tracts', 'OLF', 'MOB'], 6 : ['fiber tracts', 'OLF', 'MOB'], 7 : ['fiber tracts', 'OLF', 'MOB'], 8 : ['fiber tracts', 'OLF', 'MOB'], 9 : ['fiber tracts', 'OLF', 'MOB'...
a4aaec264b2ea3cc0aa41cf3d5511990df4b16067d29509e7a4d8ce79a11bab1
Python
182,810
4,449
#!/usr/bin/env python3 import os import sys import atexit import inspect import tempfile from pprint import pformat from pathlib import Path, PurePath as PPath from importlib import import_module, reload from collections import defaultdict from urllib.error import HTTPError import git import rdflib import requests impo...
860f5679d9680e03cc90e649fa1ae7d8ea487a7cc6162aa857a47b32a2d077c8
Python
186,445
1,237
regs_per_section ={ 1: ['root', 'CTX', 'OLF', 'MOB', 'MOBgl', 'MOBgr', 'MOBipl', 'MOBmi', 'MOBopl', 'fiber tracts', 'VS'], 2: ['root', 'CTX', 'OLF', 'MOB', 'MOBgl', 'MOBgr', 'MOBipl', 'MOBmi', 'MOBopl', 'fiber tracts', 'VS'], 3: ['root', 'CTX', 'OLF', 'MOB', 'MOBgl', 'MOBgr', 'MOBipl', 'MOBmi', 'MOBopl', 'fiber tracts'...
53029e40340638a8b5e6d68b81f504ef0fde6863bf5159fd12fbd4c2088bcd85
Python
187,423
4,870
# SPDX-License-Identifier: LGPL-3.0-or-later """Framework-agnostic LMDB data utilities for DeePMD-kit. All code here is pure Python/NumPy/lmdb/msgpack — no framework dependency. Backend-specific wrappers (PyTorch Dataset, JAX, etc.) import from here. """ import copy import dataclasses import hashlib import logging im...
20900065a5c625803644c359a939a23037dddf3a684fef4581f876082a28c7f5
Python
188,633
3,052
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt5 (Qt v5.15.2) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x04\x5e\ \x00\ \x00\x0f\x81\x78\x9c\xe5\x57\xcb\x6e\x23\x37\x10\xbc\x07\xc8\x3f\ \x10\x93\x33\x...
d8237d3a9b6c6fb8f930965c15208ebe8a90f5ef334dd16a4c76b85afbc7cbc5
Python
192,671
4,658
# SPDX-License-Identifier: LGPL-3.0-or-later """Parity tests: dpmodel ``dpa4_nn`` modules vs the reference pt ``sezm_nn`` modules. This file is extended task-by-task as the DPA4 port progresses. Index-table and numeric-helper parity is exact (``assert_array_equal`` / tight rtol). Module-level weight-copy parity tests ...
1f7a105a49bb0cbdea1d1517f250e72a27855a7d2d37a101ba2a0fd2b727ac40
Python
200,000
5,924
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 # This file contains freeze NumPy array for ImageDecoder backend test's input/output # They were generated by image_decoder.py's generate_test_data with pillow # To make ONNX backend test generation simple, use freeze NumPy array directl...
3219785d3cd748d74f6216bb53b587e9b333a422db00f0ecd9440c82848caa17
Python
200,000
5,382
# SPDX-License-Identifier: LGPL-3.0-or-later # pyright: reportMissingImports=false # ruff: noqa: ANN001, ANN202, RUF005 """Fused Triton SO(2) value path for the SeZM/DPA4 descriptor. The SO(2) value path of :class:`SO2Convolution` -- rotate-to-local, radial degree mixing, the multi-layer gated SO(2) mixing stack, and ...
345398f1ec0ac7eb11f4371cf270850d7dd430c39656e7d2cfbbfc025603de30
Python
200,000
3,471
import pandas as pd from sklearn.metrics.pairwise import euclidean_distances as euclidian_distance import random from io import StringIO import requests as r from matplotlib.collections import LineCollection import torch.nn from scipy import stats import matplotlib.pyplot as plt from sklearn.metrics import matthews_cor...
36c8220a47dcc99c7b2ee12c868fdb6993a4221b48d92e1d4057398d2afd4215
Python
200,000
5,163
# tifffile.py # Copyright (c) 2008-2022, Christoph Gohlke # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this l...
3abec55fe38ffb84d0750325f0f77ce35414104f7b543ec8e5d14dcf707df7e2
Python
200,000
3,449
from numpy import array#[discrete,41] index_cpd = array ([ 2.4061224878e-01, 2.4061224878e-01, 3.6224921707e-03, 1.7136941457e-02, 1.7136941457e-02, 1.8695002605e-02, 1.8695002605e-02, 1.8695002605e-02, 1.1793657306e-02, 1.1793657306e-02, 6.8502755171e-03, 6.8502755171e-03, 1.6318959354e-02, 1.6318959354e-0...
7c6da93b6dd4826fe6b29b29f683a8add5068a87b0568413b0e76e2e7d7dfefa
Python
200,000
5,910
# Copyright 2022 The TensorFlow Authors. All Rights Reserved. # # 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 applica...
8cbe99c1162622396fdf2e312cce98a01290db105d2247c88979d3bc39d6abe8
Python
200,000
4,775
# These medication codes were retrieved from https://biobank.ndph.ox.ac.uk/showcase/coding.cgi?id=4&nl=1 . MEDICATION_CODES = { 1185: 'vitamin e product [ctsu]', 1187: 'chondroitin product', 1189: 'co-enzyme q10/ubiquinone/bio-quinone/coenzyme q10', 1191: 'indigestion remedy (over the counter)', 11...
ab83e50fae126081111b8d1d445cfe1eef4a90d91a798928e8ef87cf7303fc53
Python
200,000
5,294
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import contextlib import gc from pathlib import Path from typing import TYPE_CHECKING, Any import numpy as np import pytest from google.protobuf import text_format from shape_inference_test_utils impor...
c791cf29d873caa2ca9495908d7dcec1351b0931a3f706a608604c1d0394f7ad
Python
200,000
5,254
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 # mypy: ignore-errors from __future__ import annotations import importlib.util import math import warnings from os import getenv from textwrap import dedent from typing import TYPE_CHECKING import ml_dtypes import numpy as np import pyte...
e8814455463dc97af1783c6a998da88190995e24ea11204fe4c70d91868d0c5f
Python
200,000
6,630
import datetime import os from pathlib import Path from medications import MEDICATION_CODES class Config: """ This class is used to encapsulate all data that can easily be manually adjusted by each of us. It is inherited by the Dataset class and there is no reason for it to ever be instantiated (if ...
d9d459b1bad3cabe41a2d54791a56d8a8d7acede3742f9854de77b7abc17dc92
Python
200,001
1,713
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Important Details about EEG data:\n", "Sampple Frequency = 200 Hz\n", "\n", "Number of Samples = 621892\n", "\n", "Duration of trial = 0.85 seconds after onset, which is indicated by firs non-zero marker value f...
4c365d582c446b79aeccec4ef88b45963ba44db3907254a4d49d0eecc30ebc69
Python
200,002
4,840
import copy import gzip import json import logging import os import re import shutil import tarfile import tempfile import zipfile from collections import defaultdict from collections.abc import Iterable, Iterator from pathlib import Path from typing import ( Any, Optional, Union, cast, ) import reques...
7a101b45b4b9ab1a9d4c2f76fbce97381a9317a28c07b5eb383ca2e08ec3581e
Python
200,002
5,038
import inspect import json import logging import os import re import shutil import sys from abc import ABC, abstractmethod from collections import defaultdict, deque from collections.abc import Iterable from copy import copy from operator import attrgetter from pathlib import Path from tarfile import ( CompressionE...
f0165bdfcd1c73d71f759ba418c59821a3ec76692c1a5672e29448cc9da4d56e
Python
200,002
5,652
# test_tifffile.py # Copyright (c) 2008-2026, Christoph Gohlke # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # t...
d8d6c58324a620b74bdbb9487127cb87844b2999b0fd86a306a3e92b9ddd4f2c
Python
200,004
6,393
import copy import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F from torch.autograd import grad from torch.optim import Optimizer import sys import glob import os import numpy as np import matplotlib.pyplot as plt from scipy.special import logsumexp from scipy.spe...
36d0043bcc0d91925f8f5cd1f81ce0cec4ebd3a2b1bdcb5dd4dbe31ffb652a27
Python
200,005
5,129
# tifffile.py # Copyright (c) 2008-2026, Christoph Gohlke # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this l...
bc34b5ba87dd3f571adac5fb5745d530e163da59855689d92fd0969c1a01cf36
Python
200,015
4,311
# SPDX-License-Identifier: LGPL-3.0-or-later import json import logging import warnings from collections.abc import ( Callable, ) from dataclasses import ( dataclass, ) from typing import ( Any, ) from dargs import ( Argument, ArgumentEncoder, Variant, dargs, ) from dargs.json_schema import...
2be012faedd11d18a292d04b2ad55f009a3f7cd420f5c911cac0ed7ae0c0d364
Python
200,016
4,327
from abc import ABCMeta from abc import abstractmethod import numpy as np import pandas as pd from tqdm import tqdm import itertools from sklearn.metrics import mean_squared_error from sklearn.metrics import r2_score from tensorflow.keras.layers import Input from tensorflow.keras.layers import Conv2D from tensorflow....
feb3b897ce181d0d97747894f660b9f1c11917636f61e8734930a59dd6045005
Python
200,020
5,802
# test_tifffile.py # Copyright (c) 2008-2022, Christoph Gohlke # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # t...
15539fc0d90f0d9bf926b83f32da9d90e51224bfefc021f5cba93cfae6ee23c5
Python
200,024
3,815
import numpy as np import pandas as pd from pandas.api.types import ( is_string_dtype, is_numeric_dtype ) import anndata as ad import networkx as nx import re from statsmodels.nonparametric.smoothers_lowess import lowess from statsmodels.sandbox.stats.multicomp import multipletests import seaborn as sns import ...
d595af914c770397973d92418fa7e3e72bdeb7889d00a2aeb5a38432a0651ccf
Python
200,031
4,102
# -*- coding: utf-8 -*- """CMA-ES (evolution strategy), the main sub-module of `cma` implementing in particular `CMAEvolutionStrategy`, `fmin2` and further ``fmin_*`` functions. """ # TODO (complex): reconsider geno-pheno transformation. Can it be a # separate module that operates inbetween optimizer and objecti...
ac6782c36076fbfb3a99121e20eeed8813877ff5914a49ffc1fe38134bfb28c6
R
58
4
library(testthat) library(pubmedR) test_check("pubmedR")
ba1f2e308de9484b0a38f33fae245dd547b1882b2580dfd91e4873db23f491fd
R
62
4
library(testthat) library(tiltedCCA) test_check("tiltedCCA")
a4c8dd38fe6e21436fd34107d7c83f82399ee4f16f037bf16c2b39cb9599b827
R
68
4
library(testthat) library(ggforestplot) test_check("ggforestplot")
48d504926c8bee9d908b39edf4d0922545026f252b6c744c337ae09a5ffa2b44
R
106
3
# % of missing data a=ifelse((is.na(pilot_data)),1,0); 100*sum(a)/(dim(pilot_data)[1]*dim(pilot_data)[2])
d2213ec44f80b1ca747507ec3290d12d19ae813d5d36d807a2d18465807741eb
R
176
6
# Create subfolder within the current working directory dir.create("R") dir.create("Output") dir.create("Output/Data") dir.create("Output/Data/csv") dir.create("Output/Plots")
b8d9e4d6c450d5555ef3925faa7fb6b4d50e20c0115d79ceaae33f0b70004934
R
198
9
inputs = list(1, 2, -5 , 4, 'oops', 0, 10) for(input in inputs) { print(paste("log of", input, "=", log(input))) } for(input in inputs) { try(print(paste("log of", input, "=", log(input)))) }
d87882967f51adfc3be76fe7d08f9c0a9d26e9e48cfcaafaa7307eb6283daa2d
R
269
11
a=read.table('PDGFRA_TSS_hg19.1k.LOOP.tss.bed.demo.bed.signal',sep='\t') b=c(as.numeric(a[2,12]),mean(as.numeric(a[2,7:11]))) pdf('f00p04_demo_pdgfra.pdf',width=5,height=3) barplot(as.numeric(a[2,7:12]),col=c(rep('grey60',5),'red'),border=F) abline(h=1) dev.off()
6281645717393a14b81be8a40017daf66d920fc133a5002025f60a946f49e730
R
301
11
gc_log=function(x,n){ row_i=as.numeric(as.character(x[7])) if(row_i < 100){ rows_k=row_i:(row_i+99) } else if(row_i > (nrow(counts_gc_2)-100)){ rows_k=(row_i-99):row_i } else { rows_k=(row_i-50):(row_i+49) } return(as.numeric(as.character(x[n]))/mean(counts_gc_2[rows_k,n])) }
2735c6d1c3a6e3a34f26cfb6a3e591764cf0348b91de2afd9f764864fa451c69
R
330
10
withWarnings <- function(expr) { #https://stackoverflow.com/a/4947528/949513 myWarnings <- NULL wHandler <- function(w) { myWarnings <<- c(myWarnings, list(w)) invokeRestart("muffleWarning") } val <- withCallingHandlers(expr, warning = wHandler) list(value = val, warnings = myWar...
123b641460c90d280a415164fe0738dc63310d85b4e405337758a9ddb9fcaff7
R
354
12
# Utilities/helper functions for preprocessing # Directories to save data to savedir_seurat <- "./data/seurat/" savedir_anndata <- "./data/anndata/" # Gene names in "Elfn1" format (mouse convention) recode_genes <- function(gene_names){ sapply(gene_names, function(name){ paste0(substr(name, 1, 1), tolower(subs...
d84e5dcb058ab64c5b97b7483e1325b6e8b69e91da392ce4a0f95d0638319603
R
359
19
# sxtTools::setwd_project() # setwd("demo_data/") # minfrac.qc = 0 # minfrac.sample = 0 # normalization.method = "svr" # optimization = TRUE # begin = 0.5 # end = 12 # step = 0.2 # ##loess parameters # multiple = 5 # threads = 3 # ##svr parameters # rerun.loess = TRUE # rerun.svr = TRUE # peakplot = TRUE # datastyle = ...
3bccdf2f06caa2b7f108d557f455db8d546f2513036796567f2aa5cd72969b97
R
364
23
set.seed(123) N=50 a=rep(1:N,each=N)/N b=rep(1:N,times=N)/N out=rbind(a,b) rownames(out)=c('a','b') colnames(out)=c(1:ncol(out)) write.table(out, file='mat.txt', row.names=T,col.names=T,quote=F,sep='\t') network=matrix(NA, nrow=1,ncol=2) network[1,1]='a' network[1,2]='b' write.table(network, file='net.txt', ro...
90a6f5f7c764c6f909031b406cdeef6093eaec500d8106f491d613bf01547388
R
370
12
# Function: Prediction Accuracy from logistic / probit regression predictionAccuracy <- function(x){ classify <- x$data |> mutate(predicted = if_else((fitted(x)) < 0.5, "0", "1"), predicted = factor(predicted, levels = (c("0", "1")))) class_table <- table(classify$predicted, classify$respon...
e1dd04e3e502f6f7f86adada7002e35367e7408fc5ce88e81d17a85c6195e4ee
R
373
14
# Function: Run permutation tests on glm-objects # Main function permutationTest_TP <- function(x) { model <- update(x, data = transform(x$data, TP = sample(TP))) } permutationTest_IF <- function(x) { model <- update(x, data = transform(x$data, IF = sample(IF))) } permutationTest_AF <- function(x) { model <- u...
cf7503cd6c3b37e80ad0822e516dd95fecd317e1ed9cc7bdede9952f541e7308
R
405
11
make_regression_table<-function(slouch.table){ saved.table<-NULL table.names<-c("Model Type","Predictors","t1/2","t1/2 min","t1/2 max","Vy","Vy min","Vy max","R2","logL","AICc","N=") for(i in 1:dim(slouch.table)[1]){ if(is.na(slouch.table[i,1])==FALSE){ saved.table<-rbind(saved.table,slouch.table[i,c(1,...
ad089c7fc6d85070c21abd79c01271ebd8613e90ee6c28618a03ba6c716f427b
R
407
14
rmMeanAdjust<-function(dataframe) { varNames<-names(dataframe) pMean<-(dataframe[,1] + dataframe[,2])/2 grandmean<-mean(c(dataframe[,1], dataframe[,2])) adj<-grandmean-pMean varA_adj<-dataframe[,1] + adj varB_adj<-dataframe[,2] + adj output<-data.frame(varA_adj, varB_adj) names(output)<-c(paste(va...
57ae1c5fc3f5e8ae5f413acd8c8648455dd68f6fd4bdef4bc39db2cb38b151b9
R
410
22
i=1 while(i<=10){ N=i*1000 set.seed(N) a=runif(N) b=runif(N) out=rbind(a,b) rownames(out)=c('a','b') colnames(out)=c(1:ncol(out)) write.table(out, file=paste0('./testN/mat',N,'.txt'), row.names=T,col.names=T,quote=F,sep='\t') network=matrix(NA, nrow=1,ncol=2) network[1,1]='a' network[1,2]='b' write.table(network, ...
a34c1aba4647263292c0aab97f2765c1a4ef0168bc8465f07f6c35f14ecaaef8
R
418
20
#!/usr/bin/env Rscript #args = commandArgs(trailingOnly=TRUE) #print(args) # THIS CHECKS THE VERSION OF R INSTALLED version # THIS CHECKS IF XGBOOST IS INSTALLED version print ("Attaching CBDA, xgboost,Superlearner, FNN and SMOTE package....") library(CBDA) library(smotefamily) library(SuperLearner) library(bartMachi...
7f7bf9b145faf94a30924b953be6d6e8452c21e3aadff03e5aeec9538baf556d
R
419
18
# Generating barplot using targets of regulons which are in the DEGs # Load pacckages library(ggplot2) # Load DEG table TF_gene <- read.csv2("DEGs_targeted_by_TFs.csv", sep = ",") head(TF_gene) p.adjust <- TF_gene$p_val_adj ########## ########## # Plot Figure 5C, Appiah et al. ggplot(data = TF_gene...
d1f9de8567fd38f2fd677c0f601a7e01107fdc081904def00780e9f64cfe8c75
R
430
18
risk_F <- function(SampleData){ risk_vector <- rep(NA, 43) for (i in 1:nrow(SampleData)) { if(SampleData[i,4] == "AF22" ){ risk_vector[i] <- "control" } if(SampleData[i,4] == "CTRL9II") { risk_vector[i] <- "control" } if(SampleData[i,4] == "ASD17AII" ){ risk_vector[i] <- "risk"...
083916455cdfbf04f8d8ba86a4a5eb466aee63980404235c0f5243e122001411
R
439
16
#' ggforestplot: Forestplot Visualizations. #' #' ggforestplot is a package for plotting measures of effect, e.g. linear #' associations or log and hazard ratios, with their confidence interval in a #' forestplot layout. It's main plotting function is \code{forestplot()}. #' #' @keywords internal #' #' @importFrom magr...
0948fb578bb53ddca78185282fa0fda3bbdc924a961bf1f804cf246c5fec8df3
R
457
24
COR=c() i=1 while(i<=10){ N=i*1000 A=read.table(paste0('./testN/this.out.ori.',N),header=T,row.names=1,sep='\t') B=read.table(paste0('./testN/this.out.r100.',N),header=T,row.names=1,sep='\t') A=t(A)[,1] B=t(B)[,1] this_cor=cor(A,B) COR=c(COR,this_cor) i=i+1 } TIME=read.table('TIME.txt',sep='\t',header=F,row.names=N...
3caa9500c50a71be984cabb5c5d1b1ebb67c1af226a8e09f4a07e9f42de9e6b6
R
485
16
library(ggplot2) setwd(dirname(rstudioapi::getSourceEditorContext()$path)) summary<-read.csv("summary_bCalAnn1.txt", na.strings = c(".", "N"), sep="\t", header = TRUE) plot(summary$edit_fraction,summary$read_fraction) p = ggplot() + geom_line(data = summary, aes(x = edit_fraction, y = read_fraction), color = "b...
bf281ad1de152ac1ed46090cf78e7ace8efc324f0f8aba76be7b4ada077fe5d0
R
488
19
#!/usr/bin/env Rscript library( "ANTsR" ) library("extremevalues" ) args<-commandArgs(TRUE) aslImg <- args[1] outname <- args[2] pasl <- antsImageRead( aslImg, 4 ) pcasl.processing <- aslPerfusion(pasl, moreaccurate=FALSE) pcasl.parameters <- list( sequence="pcasl", m0=pcasl.processing$m0 ) cbf <- quantifyCBF( pcas...
cd1b8e48cf903b2aae8e10b2c9f98a8200849df0f570355f9d0315605342ec09
R
496
12
# ipak function: install and load multiple R packages. # check to see if packages are installed. Install them if they are not, then load them into the R session. ipak <- function(pkg){ new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])] if (length(new.pkg)) install.packages(new.pkg, dependencies = T...
547e7252177a7896197f3f034148e9cb6ab379f9366efa59ae2fff90b7672675
R
504
11
c.theme <- function(){ theme_tufte() + theme(text = element_text(family = 'sans', color = 'black'), plot.title = element_text(hjust = 0.5, size = 18), axis.text = element_text(size = 13, color = 'black'), axis.title = element_text(size = 16), legend.text = element_text(siz...
398d0511401309ba93181a22eb266f70c8868be042b5ce19f8f831ba3bfd2a84
R
525
36
#/home/toolkit/tools/R4.2.0/bin/Rscript #/home/toolkit/tools/R4.2.0/bin/R source('/home/disk/database/data/ICS_scHIC/src00_ics/ICS.R') source('https://gitee.com/jumphone/VISA/raw/master/VISA.R') set.seed(123) N=50 a=rep(1:N,each=N)/N b=rep(1:N,times=N)/N N=1000 a=rnorm(N) b=a*0.3 + rnorm(N)*0.5 CEX=1 PCH=1...
fe753ff51484d74ce46c9255f2a53aea171f5e4ad218e87da814e3cd6653012a
R
535
11
install.packages("cli", repos='http://cran.rstudio.com/') install.packages("rlang", repos='http://cran.rstudio.com/') install.packages("devtools", repos='http://cran.rstudio.com/') library(devtools) install_version("gtools", version = "3.9.2") install_version("janitor", version = "2.1.0") install_version("tidyver...
60844f5071aaa0037c97afcb7bc137c5abbe004fe6bf197d9180caf3d3130ef5
R
543
12
##This function is simplifying the selection of significant exons ##The user gives dxr result object as an input and chooses the thresholds ##and gives them as pval, log2fc and ebm parameters. The output is ##a dataframe with significant dxr results Sig_F <- function(data, pval, log2fc, ebm){ sig <- as.data.frame(d...
89dffcb0b3801c9f28490439e7f84e175b3c156e504c7fb2ba662c27e95cf7b5
R
552
17
# ipak function: install and load multiple R packages. # check to see if packages are installed. Install them if they are not, then load them into the R session. local({r <- getOption("repos") r["CRAN"] <- "<https://cran.mtu.edu/>" options(repos=r) }) ipak <- function(pkg){ new.pkg <- pkg[!(pkg %in% installed.pack...
d6d9fde09573aa54c9d5c43ab8ede126b3245f50f21cb2be6f2790f76eda5c54
R
576
18
test_that("pacnet_load reads a data file under native R", { ig <- pacnet_load("liver_studies_iGenes.rds") expect_type(ig, "character") expect_gt(length(ig), 1000) }) test_that("pacnet_load names the missing file", { expect_error(pacnet_load("no_such_file.rds"), "no_such_file.rds") }) test_that("pacnet_data_ur...
03f20b05122222bca3883fc678f68a3c7925638c3fe1f62e28c9fb26f4676e10
R
599
23
#!/usr/bin/env Rscript args = commandArgs(trailingOnly=TRUE) print(args) arg_file = as.array(args[1]) print(arg_file) j_global=as.numeric(args[2]) alpha=as.numeric(args[3]) dataset_file = as.array(args[4]) workspace_directory=as.array(args[5]) label=as.array(args[6]) i_exp=as.numeric(args[7]) print(label) print(worksp...
b498cb54ce793145cda40cd01d7e0a4818662ff35efff67f269b8e0a0ebefe60
R
599
16
library(DirichletReg) dirichlet_model <- function(inputData_train, inputData_test, n_features) { if( ncol((inputData_train)) != ncol((inputData_test)) ) stop('Dataframes do not have the same shape.') data_train <- inputData_train[,1:n_features] data_train$Y <- DR_data (inputData_train[,(n_features+1):ncol(...
a0af724335267a148e1403e893ec6f572a1f4b1222a936b3241a3ae9829b1c00
R
607
18
if (!require("devtools")) install.packages("devtools") devtools::install_github("ck37/varImpact") library("varImpact") #################################### # Create test dataset. set.seed(1) N <- 200 num_normal <- 7 X <- as.data.frame(matrix(rnorm(N * num_normal), N, num_normal)) Y <- rbinom(N, 1, plogis(.2*X[, 1] + .1...