sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
c4120e9156397d6dc3d659324e021fa5b63c5de4b2602988dbe6e0b1faa241b9 | Python | 21,754 | 690 | # %reload_ext autoreload
# import sys
# sys.path.insert(0,"/home/plent/Documenten/Gitlab/NeuralODEs/jax_neural_odes")
from jaxkineticmodel.kinetic_mechanisms.JaxKineticMechanisms import *
from jaxkineticmodel.kinetic_mechanisms.JaxKineticMechanismsCustom import *
from jaxkineticmodel.kinetic_mechanisms.JaxKineticModifi... |
2b46acdb8f36e0a17bd58286078b6df3c679f9046b76ff9a00e164fd7fcd7a96 | Python | 21,759 | 507 | from copy import deepcopy
from functools import partial
from turtle import forward
import numpy as np
from pip import main
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.models.layers import drop_path, to_2tuple, trunc_normal_
from timm.models.registry import register_model
from collection... |
bc57ac3f3020c1d0ab8b9b2c54a0488d9320e3af2261b75569df8a275ca9857b | Python | 21,769 | 406 | #!/usr/bin/env python2.7
import os, sys
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["OPENBLAS_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["VECLIB_MAXIMUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
import argparse
import shlex
import shutil
import glob
import re
import traceba... |
9b5d864c268c9b32e5de70a28284d9617231223d71397f067c62170b7d08093a | Python | 21,771 | 620 | # tests/test_sweeper.py
"""Tests for the sweeper background task."""
import asyncio
import contextlib
import uuid
from datetime import UTC, datetime, timedelta
import pytest
from sqlmodel import select
from zndraw_joblib.events import JobsInvalidate, TaskStatusEvent
from zndraw_joblib.models import Job, Task, TaskSt... |
55b9c7acd292a12e6d231d53526b2bab4cccb940bd88616b832c04da1e771ee3 | Python | 21,788 | 540 | """
Utilities for labels
Copyright (c) 2015 Polytechnique Montreal <www.neuro.polymtl.ca>
License: see the file LICENSE
"""
import logging
from typing import Sequence, Tuple
import numpy as np
from scipy.ndimage import center_of_mass
# For some notes about using KDTrees for nearest-point searches, see for example:
#... |
73a1662853b3100122b37dd0c65a336a62a953e2db622ba19a425c3e7166f611 | Python | 21,788 | 503 | #!/usr/bin/env python
#
# BUSCO_phylogenomics
# Utility script to construct species phylogenies using BUSCO results.
# Assumes the same BUSCO dataset has been used on each genome
# 2026 Jamie McGowan <jamie.mcgowan@ucd.ie>
# https://github.com/jamiemcg/BUSCO_phylogenomics
import argparse
import multiprocessing as m... |
61e4b19a8ecd0d22c14e49782182a8e27cc12f37e2d4d0aae5b2fb5cfaad88ca | Python | 21,791 | 612 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Optional
import numpy as np
import torch
import torch.nn as nn
from torch_scatter import scatter
from torch_... |
05123699154601104ffda99e20f6be2efb0c6a215cb74852a25d5c838dee947d | Python | 21,804 | 708 | """Tests for Presets REST API endpoints."""
import json
import pytest
from helpers import (
MockSioServer,
auth_header,
create_test_room,
create_test_user_in_db,
)
from httpx import AsyncClient
from sqlalchemy.ext.asyncio import AsyncSession
from zndraw.exceptions import (
InvalidPresetRule,
... |
3acd5724655361dee59fef55d251ec7671eb848f1f4eb61c581f153bbd4c9934 | Python | 21,808 | 563 | ##
## CPCantalapiedra 2019
import os
from os.path import isdir as pisdir, isfile as pisfile
import shutil
import subprocess
from sys import stderr as sys_stderr
from tempfile import mkdtemp, mkstemp
from ...emapperException import EmapperException
from ...common import DIAMOND, ITYPE_CDS, ITYPE_PROTS, ITYPE_GENOME, I... |
7ba7f323b1c3c43da68efd4ad31563762f5d55cb00da890b0bbcaf9358350bb0 | Python | 21,808 | 575 | # 3D plots from stacks of imaging data
# Author: David Young, 2017, 2020
"""3D image stack interaction.
Prepare volumetric image stacks for plotting.
"""
from typing import Optional, Sequence, Tuple, Union
import numpy as np
from skimage import draw
from skimage import exposure
from skimage import filters
from skimag... |
7a47603552207c29c371454c51392888491e9c3c5d096ad39ed48610ba7ac107 | Python | 21,822 | 587 | # -*- coding: utf-8 -*-
import json
from typing import Dict, List, Sequence, Tuple
import yaml
from django import forms
from django.http import HttpResponse, HttpResponseRedirect
from django.db.models import fields as db_fields, ForeignKey
from django.db.models import Count
from django.core.exceptions import Validati... |
1dc08fa6645f394c1c9bb3ba775763f5d2e42ff366c9f4a93681118223f242ee | Python | 21,828 | 528 | import abc
import antropy
import typing as T
import logging
import numpy as np
import itertools
import sklearn
import scipy
from sklearn.metrics import precision_score
from scipy.stats import entropy
from tqdm import tqdm
from scipy.spatial.distance import pdist, squareform
# make TensorLike more flexible
from tsgm.ty... |
8e9c2023fe47dcd32647558f123ea00fe7606c457a91a3aa60c05cb422a83218 | Python | 21,842 | 650 | from rest_framework import status
from medperf.tests import MedPerfTest
from parameterized import parameterized, parameterized_class
class EncryptedKeyTest(MedPerfTest):
def generic_setup(self):
# setup users
container_owner = "container_owner"
cert_owner = "cert_owner"
ca_owner ... |
04fdfb148817d14e8ed8af017b2f24abcb1c93a778be6638ee17db01ebc5d24e | Python | 21,843 | 648 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
---
MIT License
Copyright (c) 2021 www.compscience.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this so... |
4c57ce2cdeadaf937998a4514e2f28f01b2f11b298b8e89803c711baa6ec27c2 | Python | 21,864 | 367 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
0c7f383feccb007715a8d672814cd30fdcfda11716be6eba48c04e8d778926fc | Python | 21,876 | 674 | import argparse
from scipy.spatial import distance_matrix, minkowski_distance, distance
import scipy.sparse
import sys
import pickle
import csv
import networkx as nx
import numpy as np
import time
from sklearn.metrics import precision_recall_curve
import matplotlib.pyplot as plt
from inspect import signature
import sci... |
b04e3dc1a6e9dea8454014cac7be5206e7862aa80de650d47f1ef35dd41a3a97 | Python | 21,895 | 556 | """Part of the training engine related to Python generators of array data.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import warnings
import numpy as np
from .training_utils import is_sequence
from .training_utils import iter_sequence_infinite
from... |
4fe3ad909782e62001180fe42326993ad9f956c87ee157dd59292e5e5e048224 | Python | 21,920 | 679 | # Author: Huaxu Yu
# A module for utility functions
import numpy as np
import pandas as pd
import os
from tqdm import tqdm
from datetime import datetime, timezone
import re
from collections import Counter, defaultdict
from dataclasses import dataclass
from IsoSpecPy import IsoTotalProb
#############################... |
234f528063d1929d02f375def18bce1e63ef56dd594150b051d5efedd2c88267 | Python | 21,930 | 497 | #!/usr/bin/env python
# encoding: utf-8
"""
# if Glob physiology df / ERROR if physiological doesn’t exist
# Check if we already ran the analysis / if so, abort
# Open physiology df
# Open corresponding behavioral df / ERROR if corresponding behavioral df doesn’t exist
# Clean fixation columns
# Baseline correct
# Extr... |
07eb7a0c3cc1bb02befddd91609ef352f1e6596bc88c6c0a1a4dd0f235ecb506 | Python | 21,947 | 479 | """Detail-file writers for the source-impact report.
While ``src.reports.source_impact`` renders the human-readable markdown (and a summary
JSON capped at a few samples), this module writes the detail files an SME reviews in a PR —
one subdirectory (``<output-stem>/``) beside the markdown report:
- ``new-cliques-top-... |
4d91b46db7a36127f55ffb33bc21f25cf92d61473f576fd2979d6d9b906fc202 | Python | 21,947 | 673 | import itertools
import typing
from typing import Any, Dict, List, Optional, Iterator, Tuple, Generator
from arango import ArangoClient
from kgx.config import get_logger
from kgx.source.source import Source
from kgx.utils.kgx_utils import (
generate_uuid,
generate_edge_key,
sanitize_import,
knowledge_... |
4cce3cfd7232f0a9c718e4eed33d0f5df62796fb53a19ed6df8fcbe463035e59 | Python | 21,986 | 730 | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
ab2de5ecbfea62a762252d9718b267f0bb33ef542704b0c8cdf6b41ebb682a2e | Python | 21,986 | 501 | #!/usr/bin/env python
#
# Detect vertebral levels using cord centerline (or segmentation).
#
# Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca>
# License: see the file LICENSE
import sys
import os
import argparse
from typing import Sequence
import textwrap
import numpy as np
from spinalcordtoolbox.im... |
8344f4cb5b6f87b1fd6280fe2734f48b58340689c9dc428c8eedea546d2240ee | Python | 21,990 | 580 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 2 14:59:21 2023
@author: george
"""
import pyqtgraph as pg
from qtpy.QtCore import *
from qtpy.QtGui import *
from qtpy.QtWidgets import *
from distutils.version import StrictVersion
import os, shutil, subprocess
import errno
import flika
from fl... |
c2435028f69223be43a5c4cadbed7aa59fd195aeeb25a47401f087c66a38eadd | Python | 22,013 | 565 | from collections.abc import Callable
from dataclasses import dataclass
import einops
import numpy as np
import torch
from e3nn import nn, o3
from e3nn.util.jit import compile_mode
from mace.data.atomic_data import AtomicData
from mace.modules.blocks import LinearNodeEmbeddingBlock
from mace.modules.models import MACE
... |
14773b4403a55b7a0d11fa17ac20b5f2cd85dd3b58a93a7454a65805591aa775 | Python | 22,014 | 603 | #!/usr/bin/env python3
import sys
import os
import inspect
import time
import optimizer
import linsolver
import numpy as np
from collections import defaultdict
from util_plot import *
from re import findall
from tfwrap import tf
from multigrid import (
Multigrid,
MultigridOp,
SparseOperator,
StencilD... |
5f8e273e1c5758d774b82cc269bf6b02db36e6b64e2b6ae6eca769599009e37f | Python | 22,042 | 617 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... |
8eaa8369c5d8abde342e75586dbce8746585fdb22ce51d59cec9ba4f0af3103a | Python | 22,047 | 649 | """FastAPI dependencies for database sessions, Redis, and authentication.
All resources are accessed from request.app.state.
Authentication uses zndraw-auth package.
"""
import json
from datetime import UTC, datetime
from enum import StrEnum
from pathlib import Path as FilePath
from typing import Annotated, NamedTupl... |
e9fc52debd633402862c0a5ec343ba845634ce521a5c9faeffc0df638545fa31 | Python | 22,053 | 543 | """
Wrapper to the pyGSM using ASE
"""
import os, sys, argparse
import time, textwrap
import numpy as np
# Add the ReactBench package to Python path
current_dir = os.path.dirname(os.path.abspath(__file__))
# Go up two levels: utils -> ReactBench -> ReactBench (package root)
package_root = os.path.dirname(os.path.dir... |
b285093e0cbe9b35e8b21700e10917ddff7d77f8e31ea62d4ef6a1f84535ab36 | Python | 22,059 | 527 | import numpy as np
from matplotlib import pyplot as plt
from scipy.spatial import distance_matrix
from config import subfolder_name, collect_images_at_path, precision
#this should actually be in Data_io I think, it isn't actually doing any manipulation
def initialize_dendrite(shaft_rois):
#first need to figure ... |
b140cbc42fddf60de1206862da6fbc7ebc2b0b31bd99176937eec3a9f660c631 | Python | 22,067 | 515 | ##################################################################
# Evaluate the performance of TrimNN-RGIN in testing data
# Reproducibility for Figure.2D
##################################################################
import torch
import os
import numpy as np
import dgl
import logging
import datetime
import math... |
4761bc1c58414c40b666639993127275497da2cbcc6b2449fd84c91b0b539bba | Python | 22,122 | 645 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Optional
import numpy as np
import torch
from torch_scatter import scatter
from torch_sparse import SparseTensor
from oc... |
9a61472af44c3d1d6aa38840700de91214153cd302920e401f5747953d474133 | Python | 22,137 | 522 | """
Consistency utilities for comparing GuPPy output folders across versions.
The comparison is one-directional: every file present in ``expected_dir`` must
exist in ``actual_dir`` and be numerically identical. Extra files in
``actual_dir`` that are absent from ``expected_dir`` are silently ignored.
"""
from __future... |
ac84292d7b29b84afb66e8a88029802c88658a7401496f464fda48c48bd2503c | Python | 22,137 | 648 | """eFeature classes"""
"""
Copyright (c) 2016-2020, EPFL/Blue Brain Project
This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License version 3.0 as published
by the Free... |
eb5f880f6fd70a0ea834e163db89e957800012551d3c4cf6c9ca0b4ac4273a72 | Python | 22,180 | 442 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
6652b490bc502677331a874cc24a1c610ebe0849fac780d7567c3287b6580b18 | Python | 22,203 | 674 | """This module contains functions for multiresolution alignment of autoradiographs to MRI."""
import os
from pathlib import Path
import matplotlib.pyplot as plt
import nibabel
import numpy as np
import pandas as pd
import seaborn as sns
from skimage.filters import threshold_otsu
import brainbuilder.utils.ants_nibabel... |
dea7461254329fe0670db7a2460d9ee51c5d3006e1b2dd971a4d7372b85e15af | Python | 22,232 | 519 | ##################################################################
# Evaluate the performance of RGIN+GRU in testing data
# Reproducibility for Figure.2G
##################################################################
import torch
import os
import numpy as np
import dgl
import logging
import datetime
import math
im... |
1bf898696b19744c8d1e9ed7a0b8076a59248d24babadd0f33dc5bc13ca85a63 | Python | 22,244 | 522 | ##################################################################
# Evaluate the performance of RGIN+Linear in testing data
# Reproducibility for Figure.2G
##################################################################
import torch
import os
import numpy as np
import dgl
import logging
import datetime
import math... |
abcd154c18f8145699821a32b6bbeb51981563f93e5f0d5fdec8b93c26fede45 | Python | 22,248 | 656 | import collections
import glob
import importlib
import json
import logging
import re
from abc import ABC
from enum import auto, IntEnum
import os
from pathlib import Path
from bids import BIDSLayout
import pydicom
from strenum import StrEnum
class Modality(StrEnum):
T1 = auto()
T1Post = auto()
T2 = auto... |
1a2b6cb265c520eadf9fb27e5b37403f96516c3fd6f0db09ed822a7639b5ea83 | Python | 22,272 | 735 | """ZnDraw CLI - Command-line interface for ZnDraw visualization server.
This module provides commands to:
- Start a ZnDraw server (local or detached)
- Upload trajectory files to a running server
- Check server status
- Shutdown a running server
- Connect to a remote server
"""
from __future__ import annotations
imp... |
0bb762415f5fd12f1e5d0d16c6374eff4c2fd8bbf991c53212ebbfbf6f37166e | Python | 22,285 | 566 | import os
from neo4j.exceptions import ConfigurationError
from neo4j.graph import Relationship
import provdbconnector.db_adapters.neo4j.cypher_commands as cypher_commands
from provdbconnector.db_adapters.baseadapter import BaseAdapter
from provdbconnector.db_adapters.baseadapter import METADATA_KEY_PROV_TYPE, METADAT... |
30d908601ff3a802479115853f7bd5be73c9382a53e301736a6aab503c3be4fb | Python | 22,285 | 1,020 | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime
from collections import Counter
import math
from urllib.parse import urlparse
df1 = pd.read_csv('output/ISCXURL_2016_processed.csv')
df2 = pd.read_csv('output/Phishing_Site_URls_processed.csv')
df3 = pd.read_cs... |
c931c2ddb919690223c390ccb93fd877a32642230856cbdbc6e8105a2732b113 | Python | 22,289 | 460 | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 13 12:25:41 2022
@author: guill
"""
import numpy as np
import external_functions as ef
from Network_Class_Large import SpikingNetwork, WeightMatrix
from tqdm import tqdm
from scipy.io import savemat, loadmat
from Parameters_Large import N_PYR, N_MIT, N_FBI, N_FFI, glomer... |
7457897195bcbcd25ea5cee2c62f8dad6771c44e87a6c7363a5ce72fdbd56afc | Python | 22,293 | 615 | import sys
from copy import copy
import numpy as np
import pytest
from hypothesis import assume, given, settings, strategies
import xgboost as xgb
from xgboost import testing as tm
from xgboost.compat import PANDAS_INSTALLED
if PANDAS_INSTALLED:
from hypothesis.extra.pandas import column, data_frames, range_inde... |
80f715a75372486deaa52d3673f029c12d1eb9cbfe837be6db991ba249fde39e | Python | 22,366 | 498 | # -*- coding: utf-8 -*-
from django.db import migrations
from django.conf import settings
disable_history_tracking = """
SELECT disable_history_tracking();
"""
enable_history_tracking = """
SELECT enable_history_tracking();
"""
forward = """
-- Return the unquoted name of a live table's transaction ID ... |
e4058e3b01820f8c3b361a3e4d26fd955f50bb9ce873260370b5ddaabc20bd7a | Python | 22,370 | 656 | """eFeature classes"""
"""
Copyright (c) 2016-2020, EPFL/Blue Brain Project
This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License version 3.0 as published
by the Free... |
0628281df968ea7cd903597dadc2ca0cca83082d1002d5623e3e293cf7c4cc52 | Python | 22,381 | 525 | ##################################################################
# Evaluate the performance of RGIN+PE+GRU in testing data
# Reproducibility for Figure.2G
##################################################################
import torch
import os
import numpy as np
import dgl
import logging
import datetime
import math... |
0b53ea2b3604e9143964d0d5ab657c2e71f7404e76b5f5badf74ca9177a98e9e | Python | 22,386 | 491 | from collections import defaultdict
import requests
import src.datahandlers.mesh as mesh
import src.datahandlers.obo as obo
import src.datahandlers.umls as umls
from src.babel_utils import get_prefixes, read_badxrefs, remove_overused_xrefs, write_compendium
from src.categories import ANATOMICAL_ENTITY, CELL, CELLULAR... |
53836d028c8a20b5fee280a3fd5c33bfb0bd3145062d56a54f444a1911f50a4f | Python | 22,393 | 525 | ##################################################################
# Evaluate the performance of RGIN+PE+linear in testing data
# Reproducibility for Figure.2G
##################################################################
import torch
import os
import numpy as np
import dgl
import logging
import datetime
import m... |
e5f820dbc748ca7e7cf84399ae66d4eff039bf28818add6e88e876c12cc56ba9 | Python | 22,493 | 504 | #!/usr/bin/env python
# encoding: utf-8
"""
# if Glob physiology df / ERROR if physiological doesn’t exist
# Check if we already ran the analysis / if so, abort
# Open physiology df
# Open corresponding behavioral df / ERROR if corresponding behavioral df doesn’t exist
# Clean fixation columns
# Baseline correct
# Extr... |
1171c14bbde894c159b2fa75537b89121bba2123230998ff051c90ef0b283509 | Python | 22,500 | 555 | import time, json, logging
import numpy as np
from . import utils, constants
from . import printit, config
__all__ = [
"Featurizer",
]
logger = logging.getLogger(__name__)
def wrapper_runner(func, args):
"""
Take the feature.run methods and its input arguments for multiprocessing
Parameters
----------
... |
f87be191d036af1b86ffd4c618d04133fb4976243d6702e7958f26cd43826caf | Python | 22,515 | 419 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 9, 2024
@author: camglick@stanford.edu
purpose: To generate plots for sptms/fmri paper
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Specify Subjects Included
subs_included =(1001,1003,1009,1015... |
a12b67a68150c468540f596251df1e8c8a91e4a6b996aa6ad9fad8fb9ab0e0fd | Python | 22,533 | 461 | """
Loads a pre-trained VGAE evaluates reconstructions on a new dataset.
Then, a new MLP is trained on the VGAE latent representations of
the new dataset.
Author: Hanna Tolle
Date: 2025-10-31
License: BSD-3-Clause
"""
import matplotlib
matplotlib.use('Agg') # Set non-interactive backend
import sys
sys.path.appen... |
103cad78f57e63e8b7bd90eb6cbd5f3cca2640f0af40306cf3d82a17caa56ea0 | Python | 22,549 | 584 | # -*- coding: utf-8 -*-
from collections import defaultdict
import datetime
from functools import reduce
import json
import operator
from typing import Any, Dict, DefaultDict, List, Optional, Tuple
from django.http import HttpRequest, JsonResponse
from django.shortcuts import get_object_or_404
from django.db import c... |
c44f39b29b3852a0ca47d55a62237b84b1a2d5ea0ea5c71da6b99a1b1ee9a340 | Python | 22,560 | 525 | ##################################################################
# Evaluate the performance of TrimNN in testing data
# Reproducibility for Figure.2D
##################################################################
import torch
import os
import numpy as np
import dgl
import logging
import datetime
import math
impo... |
2b3c7a3aeb81df89482d57794202b5b27ef10bcffd1cf93b0321227752f07a50 | Python | 22,561 | 477 | import json
import h5py
import numpy as np
import pandas as pd
import pytest
from guppy.testing.consistency import (
_collect_relative_paths,
_compare_json_values,
_normalize_psth_index,
_normalize_psth_label,
_normalize_psth_str_array,
compare_output_folders,
)
class TestNormalizationHelper... |
88d877302c813620debcd26769521f1b1f850cc986a5d990ecd5718d0604186a | Python | 22,624 | 651 | # Copyright (c) OpenMMLab. All rights reserved.
from collections import OrderedDict
from typing import Tuple, Union
import torch
import torch.nn.functional as F
from torch import nn
class Bottleneck(nn.Module):
"""Custom implementation of Bottleneck in ResNet."""
expansion = 4
def __init__(self, inplane... |
f28a01c07a2795ad330be18291f689a090ffd34f61fb821e63015bb69322c86c | Python | 22,629 | 575 | import numpy as np
import torch
import gymnasium as gym
import argparse
import os
import wandb
import yaml
import random
import time
from tqdm import tqdm
import ev2gym
from ev2gym.rl_agent.reward import ProfitMax_TrPenalty_UserIncentives
from ev2gym.rl_agent.reward import SimpleReward
from ev2gym.rl_agent.state impo... |
4d25e2c78307779f60e69f63767e7615cb628db0dc8d4d1a1cf713190e16fdb5 | Python | 22,634 | 665 | """Frame REST API endpoints for room frame CRUD operations.
Returns MessagePack-encoded binary data for efficient transfer:
- Success (200 OK): application/x-msgpack with raw frame data
- Error (4xx/5xx): application/problem+json per RFC 9457
Frame data format: list[dict[bytes, bytes]] where:
- Keys: b"arrays.positio... |
7bc0e50f4a5ddbd830649675a50fbad227804aa0b1a36847f9a7463a4653d2e7 | Python | 22,648 | 600 | # -*- coding: utf-8 -*-
from typing import Any, Dict, List, Union
from io import StringIO, BytesIO
import json
import logging
from PIL import Image
from django.conf import settings
from django.db import connection
from django.http import HttpRequest, HttpResponse, JsonResponse
from django.utils.decorators import meth... |
e62367f578a3ec2d3ea08de4f59debf539a7a52664dcb7d58d31e76806c4cb32 | Python | 22,660 | 691 | import numpy as np
from scipy.signal import find_peaks
from joblib import Parallel, delayed
from myphdlib.general.toolkit import psth2, smooth
from decimal import Decimal
import h5py
# TODO
# [X] If standardizing the response, use a common estimate of mu and sigma
# [X] Base the estimate of latency-shifted sacade-rela... |
3ac9a4527aedf0772e5132dfd8ecc0de1e39606de88c008c980ef7a83c0ef900 | Python | 22,666 | 562 | from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
#from builtins import str
from builtins import range
from quantities.quantity import Quantity
import sciunit
from sciunit import Test,Score
try:
from sciunit import ObservationError
except:
from sciunit.... |
59d37d3a42677be01f24987de98dd71e5e51c97a8ddb86a46364e0e00727f92b | Python | 22,666 | 559 | import torch
from torch import nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence,pad_sequence
from torch.utils.data import DataLoader, TensorDataset
from torch.optim.lr_scheduler import ExponentialLR, StepLR, LinearLR
from torch.utils.data import Dataset, DataLoader
from dataset import SpokenD... |
8544076fd96a0b351aaf2fd616d9a1548a63ca50e60c12031179f538be8f55a1 | Python | 22,667 | 602 | import torch
import matplotlib.pyplot as plt
import torchvision
from torch.utils.data import DataLoader, Subset, TensorDataset
import torch.nn.functional as F
import torch.optim as optim
import torch.nn as nn
import numpy as np
import math
import json
# from sklearn.decomposition import PCA
from torchvision import tran... |
76c160b6b3c926b2ce7ae54f2e02a40d53f3e8527dca309136b9081687ce88d0 | Python | 22,694 | 507 | import torch
import numpy as np
import os
import sys
import math
import logging
import json
from tqdm import tqdm, trange
from process_eicu_k_fold import get_datasets
from utils import *
from graph_convolutional_transformer import GraphConvolutionalTransformer
from datetime import datetime
import pandas as pd
from te... |
e06e789af9a82fe86fff7636a198cdca38c79376dda5c729fe1e64f6abb2be53 | Python | 22,694 | 570 | """
TRF Module for Neural Encoding with Time-Delayed Regression Models
This module contains the implementation of a TRF (Temporal Response Function) class for performing
neural encoding using time-delayed linear regression models. It includes functionality for
cross-validated model fitting, evaluation of model perfo... |
48f3e9487fe1b6814b9d753c324291f8ba0f20872067476e3728f6d1d224b9f1 | Python | 22,696 | 688 | #!/usr/bin/env python
"""
Compare how the three feature families reach the GPU.
Runs the same featurization three times -- once with a static feature, once with
MarchingObservers, once with DensityFlow -- each under Nsight Systems, and
reports the launch pattern rather than only the total time: how many kernels are
la... |
50e42354fc91cac98ba6a98d3a0e4da87b91072dc2ad5e6c135edf64db7eeac4 | Python | 22,728 | 580 | # Current version -- v3
import numpy as np
import pandas as pd
import sys
import preproc_utils as utils
from sklearn.model_selection import KFold, StratifiedKFold, train_test_split
def valid_feat_name(c):
v = c not in ["index", "preictal", "trust", "seizing", "time_idx", "group", "GA", "y", "Unnamed: 0", \
"fn... |
401824a5fc31e2648a4ac652eac170f1c71712e87b46d778ce8f8a011e86d2f3 | Python | 22,743 | 606 | #!/bin/env python
# Author: Qiyuan Zhao (zhaoqy1996@gmail.com)
import subprocess
import os
import numpy as np
import re
import psutil
import logging
from ReactBench.utils.parsers import xyz_parse
from ReactBench.utils.taffi_functions import table_generator
logger = logging.getLogger(__name__)
THRESH = ["gau_loose", "... |
4da1a4158c97337723bc5f7a210e3dc7e8ff115b4d7753c5eab0910f9581f36c | Python | 22,788 | 596 | import os
import typing as T
import glob
import scipy
import collections
import logging
import yfinance as yf
import sklearn
import sklearn.datasets
import numpy as np
import numpy.typing as npt
import pandas as pd
import scipy.io.arff
import keras
from tsgm.types import Tensor as TensorLike
from tsgm.utils import ... |
03fd26dcef6217e700b45cdff6bcfc0d31df7731ac6a596d6c8511db9edf0771 | Python | 22,825 | 554 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import build_norm_layer
from mmcv.cnn.bricks.drop import build_dropout
from mmengine.model import BaseModule, ModuleList
from mmengine.model.weight_init im... |
c4a5b6c2aa124873ccf78cb0a43bbc423a50d73e83d3bb016c0aff2746eca770 | Python | 22,844 | 378 | import argparse
import os
from collections import OrderedDict
import nearl.data
import numpy as np
import nearl
from nearl.io.traj import MisatoTraj
# Define the way to generation labels for the misato trajectories
def parser():
parser = argparse.ArgumentParser(description="Featurize the misato trajectories")
... |
06163570155c68071a25e691c7199daf6af98576fbaf5364d697153b5b6a8f4c | Python | 22,846 | 551 | import numpy as np
import pandas as pd
from rdkit import Chem
import torch
from torch.utils.data import IterableDataset
import dgl
import random
from dgl.dataloading import GraphDataLoader
from rdkit.Chem.BRICS import FindBRICSBonds, BreakBRICSBonds
from rdkit.Chem import ChemicalFeatures
from rdkit.Chem import MACCSke... |
08890fd743142628b62e15c387cf74992c6791f070350c09843ca57c6f87ddcd | Python | 22,854 | 606 | import torch
import matplotlib.pyplot as plt
import torchvision
from torch.utils.data import DataLoader, Subset, TensorDataset
import torch.nn.functional as F
import torch.optim as optim
import torch.nn as nn
import numpy as np
import math
import json
from sklearn.decomposition import PCA
from torchvision import transf... |
8a14c18e825a8c7298f665235f27247a90d241d70bc3d1b600b3ff447768589a | Python | 22,890 | 694 | from numpy import float32
import torch
import torchvision
from torch import Tensor, dropout, nn
import torch.nn.functional as F
import math
import torchinfo
from torchvision.models.feature_extraction import get_graph_node_names
from torchvision.models.feature_extraction import create_feature_extractor
import torchvisio... |
5aec041bf4245b4da997c6fad45bebb304bf706e0a832dbcae173cad32f2a72d | Python | 22,893 | 416 | #!/usr/bin/env python2.7
import sys, os
import argparse
import math
import itertools
import multiprocessing as mp
from multiprocessing import Lock, Value, Pool
from collections import defaultdict
from collections import Counter
import numpy as np
import scipy.stats
from Utils import *
from Clusterizer import *
from... |
0476ed65b1068d4cf753a0934bc50a39d8df396edee8939e425ec63316d5d8bd | Python | 22,894 | 485 | import copy
from textwrap import dedent
import numpy as np
import pandas as pd
from ..client import inject_client
from ..utils import tqdm, iter_batches
from .neuroncriteria import neuroncriteria_args
from .synapsecriteria import SynapseCriteria
from .mitocriteria import MitoCriteria
from .synapses import fetch_synap... |
063c29b1c1b17acc16aff4129a327ef7519c44bbb6d88d15fe9d679a57331a1c | Python | 22,927 | 593 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# pyre-strict
# pyre-ignore-all-errors[2,3,58]
import logging
import os
from collections import defaultdict
from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Tuple
import numpy as np
import torch
import torch.nn as nn
from iopa... |
918377fef53d252ac3e6cb189ed78bfd2bac16dd11f4e53c35581e51989387aa | Python | 22,936 | 622 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import (ConvModule, DepthwiseSeparableConvModule,
build_activation_layer, build_norm_layer)
from mmengine.model import BaseModule
from mmseg.registry import MODELS
from ..utils import resize
class D... |
8399bd7783853480123107ffac5b63d8dabadbc94d10b0c288f4d0ab8146966c | Python | 22,940 | 750 | import numpy as np
from . import stats
from netneurotools import datasets as nndata
import os.path as op
from nilearn import image
import sys
import os
import warnings
from collections import OrderedDict
import subprocess
"""
Utility functions (C) Systems Neuroscience Newcastle &
Nikitas C. Koussis 2023
"""
DROP = [... |
894a149422476767938a62e4fa48d94ba8d77cae3601745d511c436d7f3c166b | Python | 22,943 | 457 | import argparse
import json
import os
import sys
from multiprocessing.pool import ThreadPool
from pathlib import Path
import numpy as np
import torch
from tqdm import tqdm
FILE = Path(__file__).resolve()
ROOT = FILE.parents[1] # YOLO root directory
if str(ROOT) not in sys.path:
sys.path.append(str(ROOT)) # add ... |
b630230ff4a0f39637196cbab18d98cbfaa1f97a83ecb649de218507a6da240c | Python | 22,969 | 524 | """
Loads trained VGAEs and extracts the attention weights of the readout layer.
Analyses the attention weights in terms of resting state networks (RSNs) and
receptor distributions.
Attention weights are computed for all subjects with all fold models, then
they are compared across folds (correlation heatmap for each s... |
91783fe0b561e8dfd873310a3375b5ad215cb37d0d89a66cc0c32bab02c7db6d | Python | 22,975 | 458 | import argparse
import json
import os
import sys
from multiprocessing.pool import ThreadPool
from pathlib import Path
import numpy as np
import torch
from tqdm import tqdm
FILE = Path(__file__).resolve()
ROOT = FILE.parents[1] # YOLO root directory
if str(ROOT) not in sys.path:
sys.path.append(str(ROOT)) # add ... |
569e29cac132d21e25e4cd56fb1d87b1a0f55865873d949d75e6d7034909da04 | Python | 22,984 | 493 | ##################################################################
# Evaluate the performance of NSIC in testing data
# Reproducibility for Figure.2D
##################################################################
import torch
import os
import numpy as np
import dgl
import logging
import datetime
import math
import... |
c4b2fed1eb2ace7d1b9ad3674318e02aa40b829d2ce524e242a0000cd758546e | Python | 22,990 | 409 | # pytest unit tests for spinalcordtoolbox.process_seg
# TODO: add test with known angle (i.e. not found with fitting)
# TODO: test empty slices and slices with two objects
import pytest
import math
import copy
from datetime import datetime
from random import uniform
import numpy as np
import nibabel as nib
from scipy... |
47a2d3bf146e8dec10176c4bb6534e6fd8b7964787ede52a0b2d8419cc00412e | Python | 23,002 | 656 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The TrainModel class
@author: Andrei Istudor andrei.istudor@gmail.com
"""
import gc
import tracemalloc
import torch
import torch.nn
import torch.optim
from torch.autograd import Variable
from random import randint
import numpy as np
from os import path
# from ... |
bf3e30f9180e9eb07e85d3e15aac8b3906a2ba508d904102439cd0dc3aa88031 | Python | 23,008 | 659 | #!/usr/bin/env python
"""
Split a dynamic-feature run into host time and device time.
Exercises only DensityFlow and MarchingObservers with the ``mass`` weight, so the
numbers reflect Nearl's own kernels rather than RDKit/OpenBabel/ChargeFW2.
With Nsight Systems present the script re-executes itself under ``nsys`` an... |
4d8b619c3741f101f0afcc1d23824b79b6ce9fd67f12a5177c609c57fac5de46 | Python | 23,016 | 482 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 13 15:25:24 2022
@author: george
"""
import warnings
warnings.simplefilter(action='ignore', category=Warning)
import numpy as np
import pandas as pd
from tqdm import tqdm
import math
from scipy import stats, spatial
from pathlib import Path
from s... |
cdc7cbdca257b00dd9cb0d2284124329eeb8f39b8922bf9a464c05ebcf8dc8ef | Python | 23,029 | 661 | """This module is adapted from https://github.com/Open-Catalyst-Project/ocp/tree/master/ocpmodels/models
"""
import torch
import torch.nn as nn
from fairchem.core.common.utils import conditional_grad
from torch_scatter import scatter
from ccdvaeplus.pl_modules.equiformer_v2.equiformer_v2 import EquiformerV2, ... |
63523ed9b0f93ea330e1472905f54789965600985bf664cd5721b63c7e251ab3 | Python | 23,047 | 531 | import torch
import torch.nn as nn
import torch.nn.functional as F
import sys, os, json
import argparse
import time
import numpy as np
from tqdm import trange
from torchvision import datasets, transforms
import matplotlib.pyplot as plt
import csv
from PIL import Image
from Adversarial_Observation.Swarm import PSO as... |
a55ef601ffdd29f3a18356557ac8e18460b1cff192f091cd48f14fd15acf0599 | Python | 23,057 | 698 | import os
from subprocess import run
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
# from brainbuilder.utils.nl_deformation_flow import nlflow_isometric
from morphint.morphint import morphint
import brainbuilder.utils.ants_nibabel as nib
from brainbuilder.align.align_2d import apply_tra... |
11a6b3cd9ef31ccb616bf0c33471158ce785aec59b360105a3706a99a680c5d1 | Python | 23,065 | 579 | # Author: Hauxu Yu
# A module to align features (characterized by unique m/z and retention time) from different files.
# imports
import numpy as np
import pandas as pd
import os
from tqdm import tqdm
from scipy.interpolate import interp1d
from scipy.stats import zscore
import pickle
from copy import deepcopy
from .... |
5c54f725635a31bd2bb9abf721f2ebbd30a54fd5e5f0159fbb1e59882a4414c9 | Python | 23,069 | 695 | # -*- coding: utf-8 -*-
# encodermap/misc/misc.py
################################################################################
# EncoderMap: A python library for dimensionality reduction.
#
# Copyright 2019-2024 University of Konstanz and the Authors
#
# Authors:
# Kevin Sawade, Tobias Lemke
#
# Encodermap is free ... |
d41917f2f78efc5dc7e652fe9fffab29872ab0acaf1983d956c55aa1954bbf37 | Python | 23,076 | 770 | """RFC 9457 Problem Details for HTTP APIs."""
import re
from typing import Any, ClassVar, NoReturn
from fastapi import Request
from fastapi.responses import JSONResponse
from zndraw_joblib.exceptions import (
ProblemDetail,
ProblemError,
ProviderTimeout,
TaskNotFound as JoblibTaskNotFound,
Worker... |
24ecfeaa66ff5b1b922c70ae57c9d4bca120737aea05a4f9e254f61ab393a191 | Python | 23,084 | 546 | """Recurrent layers backed by cuDNN.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .. import backend as K
from .. import initializers
from .. import regularizers
from .. import constraints
from .recurrent import RNN
from ..layers import InputSpec
... |
28289aa16bf41c26dcf747df5ed99378c3473362ac3bed3bcaddd816466f035a | Python | 23,085 | 722 | import h5py
import pathlib as pl
import numpy as np
from matplotlib import pyplot as plt
from myphdlib.general.toolkit import smooth, stretch, psth2
from sklearn.decomposition import PCA
from sklearn.cluster import KMeans, AgglomerativeClustering, Birch
from sklearn.mixture import GaussianMixture
from sklearn.preproces... |
7e714548fe949ee53a735259da1134f35fcadd56f5f060b192196ba686505137 | Python | 23,095 | 442 | import cv2
import numpy as np
from matplotlib.colors import hsv_to_rgb
from data.transforms import find_brightest_band
from scipy.interpolate import interp1d
def generate_distinct_colors(N):
"""
Generate N visually distinct RGB colors using evenly spaced hues in HSV color space.
Parameters:
N... |
a48c9bd10e419e2f8bb11f66a6ff5b445bb5e66307f54aa7553c0033dd4b3188 | Python | 23,135 | 625 | # -*- coding: utf-8 -*-
"""
Functions related to fetching and manipulating skeletons.
"""
from io import StringIO
from itertools import combinations
from collections import namedtuple
import numpy as np
import pandas as pd
import networkx as nx
from scipy.spatial import cKDTree
from .client import inject_client
@in... |
578e6c26c5c0ba99ae08b7d9067d24b1ba143d10c7d8981fc6e0bd0b87688850 | Python | 23,146 | 533 |
import processing.manhattan_plot_util as man_plot
import processing.impute_fncs as impute_fncs
from scipy.stats import scoreatpercentile
import pandas as pd
import os
from tqdm import tqdm
'''
Predict phenotype changes from LBACs (or MBACs)
Repeat code block with changing MAIN_FOLDER to keep track of different itera... |
2dd8d89ec523001600f1d6fa7a4674ec12947d96c1cf05dc3cd1c3d9fca3d852 | Python | 23,147 | 506 | # Copyright DST Group. Licensed under the MIT license.
from ipaddress import IPv4Address, IPv4Network
import numpy as np
from CybORG.Shared.Enums import TernaryEnum, ProcessName, ProcessType, ProcessVersion, AppProtocol, OperatingSystemType, \
OperatingSystemVersion, OperatingSystemDistribution, Architecture, Ses... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.