repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
FelixSchwarz/htmlcompare
htmlcompare/compare.py
# -*- coding: utf-8 -*- # SPDX-License-Identifier: MIT from __future__ import absolute_import, print_function, unicode_literals from collections import namedtuple import re import html5lib from .compare_css import compare_css __all__ = ['CompareResult', 'Difference', 'compare_html'] Difference = namedtuple('Diff...
FelixSchwarz/htmlcompare
htmlcompare/tests/basic_test.py
# -*- coding: utf-8 -*- # SPDX-License-Identifier: MIT from __future__ import absolute_import, print_function, unicode_literals from unittest.case import TestCase from .. import assert_different_html, assert_same_html class BasicTest(TestCase): def test_can_compare_single_tag(self): assert_same_html('<...
mitmedialab/physioHMD
Software/Recognition/DataAcqusiton/udpclientex.py
import socket UDP_IP_ADDRESS = "127.0.0.1" UDP_PORT_NO = 6790 cs = socket.socket(socket.AF_INET , socket.SOCK_DGRAM) process = str(1)+","+str(10)+","+str(100) while True: ch = str(input()) cs.sendto(ch, (UDP_IP_ADDRESS,UDP_PORT_NO))
mitmedialab/physioHMD
Software/Recognition/DataAcqusiton/udpclientv3.py
<filename>Software/Recognition/DataAcqusiton/udpclientv3.py import socket import sys import time import serial import threading import numpy as np from scipy import signal from scipy.signal import lfilter , iirnotch , butter , medfilt , filtfilt import csv writeToFile = True read = True calibration = True calibrated ...
mitmedialab/physioHMD
Software/Recognition/TestUsingAquData_copy.py
# encoding=utf-8 from __future__ import print_function import scipy.io import scipy.io as scio import numpy as np import tensorflow as tf import matplotlib.pyplot as plt # from builtins import print from scipy import signal from sklearn import preprocessing from sklearn.decomposition import FastICA,PCA from scipy.signa...
mitmedialab/physioHMD
Software/data streaming/udpclient.py
import socket import sys import time import serial import numpy as np from scipy import signal from scipy.signal import lfilter , iirnotch , butter , filtfilt import csv def process(): global strm,m1p,m2p,m3p,m4p,o1p,o2p,o3p,o4p,win,cnt if strm >= 100: normalize() remove_artifacts() s...
mitmedialab/physioHMD
Software/Recognition/DataAcqusiton/server.py
import socket import sys import time import serial import threading import numpy as np from scipy import signal from scipy.signal import lfilter , iirnotch , butter win = 100 fs = 1000 whp = 30.0/fs Q = 30 read = True startP = False m1 = [] m2 = [] m3 = [] m4 = [] o1 = [] o2 = [] o3 = [] o4 = [] m1p = np.zeros(win)...
mitmedialab/physioHMD
Software/Recognition/RealTimeML_output.py
<reponame>mitmedialab/physioHMD<filename>Software/Recognition/RealTimeML_output.py # encoding=utf-8 from __future__ import print_function import scipy.io import scipy.io as scio import numpy as np import tensorflow as tf import matplotlib.pyplot as plt # from builtins import print from scipy import signal from sklearn ...
mitmedialab/physioHMD
Software/Recognition/TestUsingAquData.py
<reponame>mitmedialab/physioHMD # encoding=utf-8 from __future__ import print_function import scipy.io import scipy.io as scio import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from builtins import print from scipy import signal from sklearn import preprocessing ## test data # TestData = scip...
mitmedialab/physioHMD
Software/Recognition/AlexaNetTrain.py
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import from __future__ import division import argparse import sys import tensorflow as tf import numpy as np import scipy.io import tensorflow as tf from timeit import default_timer as timer import matplotlib.pyplot as plt ...
mitmedialab/physioHMD
Software/Recognition/train.py
from __future__ import print_function # from builtins import print import numpy as np import scipy.io import tensorflow as tf import scipy.io as scio from timeit import default_timer as timer import matplotlib.pyplot as plt start = timer() trainData = scipy.io.loadmat('Trainset0504_Gul_12Exp_8960_2579.mat')['TrainD...
chuckfairy/TYOS
src/apps.py
<filename>src/apps.py #apps.py #Copyright (c) 2015 <NAME> #MIT License import pygame, sys from pygame.locals import * import imp from constant import * class App(): def __init__(self, fona): self.fona = fona #Important Variables and constants self.open_apps = False self.pixel = 0 ...
chuckfairy/TYOS
src/toolbar.py
#App Toolbar #copyright (c) 2015 <NAME> #MIT License import time import os import pygame from constant import * from pygame.locals import * class Toolbar(): def __init__(self, fona): self.UPDATE_TIME = 30 self.DEAD = 30 #Setup fona self.fona = fona #Define colors ...
chuckfairy/TYOS
src/constant.py
<gh_stars>0 import os SRC_DIR_PATH = os.path.dirname(os.path.realpath(__file__)) ROOT_DIR = SRC_DIR_PATH + "/../" APP_PATH = SRC_DIR_PATH + "/../apps/"
chuckfairy/TYOS
utils/list-modes.py
import pygame pygame.init() print pygame.display.list_modes()
chuckfairy/TYOS
src/serialport.py
# -*- coding: utf-8 -*- #TYOS Serial Interface with Fona #copyright (c) 2015 <NAME> import serial, time class SerialPort(): has_fona = False def __init__(self): self.baud_rate = 9600 def connect(self): #open connection self.serialport = serial.Serial("/dev/ttyAMA0", self.baud_rat...
chuckfairy/TYOS
utils/hello.py
import pygame, sys from pygame.locals import * # set up pygame pygame.init() # set up the window windowSurface = pygame.display.set_mode((500, 400), 0, 32) pygame.display.set_caption('Hello world!') # set up the colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255)...
selvamshan/custom_edge_nagram
edge_char_ngarm.py
<reponame>selvamshan/custom_edge_nagram<filename>edge_char_ngarm.py import numpy as np import pandas as pd from nltk.corpus import stopwords from nltk import download from nltk import word_tokenize from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import linear_kernel class Edg...
sszokoly/rtpstreams
rtpstreams.py
<reponame>sszokoly/rtpstreams #!/usr/bin/env python # -*- encoding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals import itertools import os import shlex import shutil import string from copy import copy from collections import OrderedDict, Counter from operator import itemget...
Turta-io/Relay-uHAT
Libraries/Python/Turta_Relay.py
# Turta Relay uHAT Helper for Raspbian. # Distributed under the terms of the MIT license. # Python Library for relays. # Version 1.0.0 # Released: November 9th, 2019 # Visit https://docs.turta.io for documentation. import RPi.GPIO as GPIO class RelayController: """Relay Controller""" #Variables is_init...
Turta-io/Relay-uHAT
Samples/Python/relay_control.py
#!/usr/bin/env python3 #This sample demonstrates turning relays on and off. #Install Relay uHAT library with "pip3 install turta-relayuhat" from time import sleep from turta_relayuhat import Turta_Relay #Initialize relay = Turta_Relay.RelayController() try: while 1: #Turn on relay 1 relay.write(...
Turta-io/Relay-uHAT
Samples/Python/relay_toggle.py
#!/usr/bin/env python3 #This sample demonstrates toggling the relays. #Install Relay uHAT library with "pip3 install turta-relayuhat" from time import sleep from turta_relayuhat import Turta_Relay #Initialize relay = Turta_Relay.RelayController() try: while 1: #Toggle relays 1 to 2 for x in rang...
cpolhout/core
homeassistant/components/recorder/history.py
<filename>homeassistant/components/recorder/history.py """Provide pre-made queries on top of the recorder component.""" from __future__ import annotations from collections import defaultdict from collections.abc import Callable, Iterable, Iterator, MutableMapping from datetime import datetime from itertools import gro...
elhafizzo/widevine-l3-guesser
misc/Memsearcher.py
<filename>misc/Memsearcher.py # script that I used to look up values and dump constants out of memory dumps produced by Ghidra emulator. Very rough. import struct import gzip import sys import os fl1=sys.argv[1] #fl2=sys.argv[2] srch=None if len(sys.argv)>2: srch=sys.argv[2] def readRegister(dct,fl): dt=...
elhafizzo/widevine-l3-guesser
misc/oaep.py
<reponame>elhafizzo/widevine-l3-guesser #simple script that shows how to unmask OAEP padding from big integer import hashlib def i2osp(integer, size): return bytes([((integer >> (8 * i)) & 0xFF) for i in reversed(range(size))]) def mgf1(input_str, length, hash=hashlib.sha1): """Mask generation function...
Potatoasad/ringdb
ringdb/StrainDatabase.py
<reponame>Potatoasad/ringdb<filename>ringdb/StrainDatabase.py<gh_stars>0 import os import subprocess import ringdown import pandas as pd import numpy as np import h5py from . import File default_schema = {'sample' : {'type': 'array', 'path': '{detector}/strain/Strain'}, 't0': {'type': 'attribute', 'n...
Potatoasad/ringdb
ringdb/Database.py
import os import subprocess import ringdown from . import File import pandas as pd import numpy as np from functools import cached_property import h5py try: import importlib.resources as pkg_resources except ImportError: # Try backported to PY<37 `importlib_resources`. import importlib_resources as pkg_res...
Potatoasad/ringdb
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() description = '''A gravitational event database that queries and locally saves event strain samples, detector PSDs and posterior samples - all in one place''' setu...
Potatoasad/ringdb
ringdb/PosteriorDatabase.py
import os import subprocess import ringdown from ringdown import PowerSpectrum from tqdm import tqdm from .peak import complex_strain_peak_time_td from . import File import pandas as pd import numpy as np import matplotlib.pyplot as plt approximant_order = ["IMRPhenomPv2", "IMRPhenomPv3", "IMRPhenomXPHM", "IMRPhenomHM...
Potatoasad/ringdb
tests/download_tests.py
import pytest import pandas as pd from ringdb import Database def create_db(): db = Database("./Data") db.initialize() return db class TestRingdown: test_event = "GW190521" test_events = ["GW150914", "GW190521", "GW190426_190642", "GW200220_061928"] non_GWTC1_tests = ["GW190521", ...
Potatoasad/ringdb
ringdb/__init__.py
__all__ = [] import pandas as pd import numpy as np import ringdown import h5py import subprocess import os import lalsimulation as ls import tqdm try: import importlib.resources as pkg_resources except ImportError: # Try backported to PY<37 `importlib_resources`. import importlib_resources as pkg_resourc...
Potatoasad/ringdb
ringdb/File.py
<reponame>Potatoasad/ringdb<gh_stars>0 import os import subprocess import h5py class File: def __init__(self, rel_path): self.path = rel_path @classmethod def from_url(cls, url, save_folder, new_filename=None): # Remove trailing "/" from path if save_folder[-1] == "/": ...
gustavonaldoni/currency-desktop-notifier
values_tracker.py
<filename>values_tracker.py class LastValuesTracker: def write_last_value(self, base_coin_abbreviation, last_coin_abbreviation, value): with open('last-values.txt', 'w') as file: file.write(f'{base_coin_abbreviation} <-> {last_coin_abbreviation} = {value}') def get_last_value(self, path): ...
gustavonaldoni/currency-desktop-notifier
notifier.py
<gh_stars>0 from win10toast import ToastNotifier import time class Notifier: def __init__(self, icon_path): self.icon_path = icon_path self.notifier = ToastNotifier() def show_notification_endless(self, title, message, duration): while True: self.notifier.show_toas...
gustavonaldoni/currency-desktop-notifier
main.py
<gh_stars>0 from currency import CurrencyExchanger from notifier import Notifier icon_path = './icon.ico' notifier = Notifier(icon_path) exchanger = CurrencyExchanger() brl_to_dolar_rate = exchanger.get_brl_to_dolar_rate() default_title = 'A new rate was found!' default_message = f'OMG! We have discovered that 1 US...
gustavonaldoni/currency-desktop-notifier
currency.py
<reponame>gustavonaldoni/currency-desktop-notifier from forex_python.converter import CurrencyRates class CurrencyExchanger: currency = CurrencyRates() def get_brl_to_dolar_rate(self): dolar_to_brl_rate = round(self.currency.get_rate('USD', 'BRL'), 2) return dolar_to_brl_rate def conve...
adamcrowe242/logprune
main.py
<reponame>adamcrowe242/logprune<filename>main.py<gh_stars>0 # This program is designed to act as a replacement to the Logrotate # program (https://linux.die.net/man/8/logrotate). Like Logrotate, is used for maintaining logs # of the # The behaviour of this program is as follows: # -- Iterate through each logLevel # --...
adamcrowe242/logprune
TestSuite.py
<gh_stars>0 import os, shutil, filecmp from distutils.dir_util import copy_tree from TestSuiteConfig import * class TestUnit: def __init__(self, unitToTest): self.unitToTest = unitToTest self.failedDirectories = [] self.originalFilesDirectory = ORIGINAL_FILES_PATH.format(unitToTest) ...
adamcrowe242/logprune
config.py
UNZIPPED_SIZE_LIMIT = 1048576 # 1MB ZIPPED_SIZE_LIMIT = 314572800 # 300MB (50MB PER LOGLEVEL) INTERVAL = 60 # time between each run in seconds PATH = "./logs/" LOGLEVELS = ["debug", "info", "notice", "warning", "err", "crit"]
adamcrowe242/logprune
TestSuiteConfig.py
<reponame>adamcrowe242/logprune ORIGINAL_FILES_PATH = "./Testing/{0}/OriginalFiles" TEST_OUTPUT_PATH = "./Testing/{0}/Temp" OUTCOME_FILES_PATH = "./Testing/{0}/ExpectedOutcomes" TESTING_UNZIPPED_SIZE_LIMIT = 10 # bytes TESTING_ZIPPED_SIZE_LIMIT = 250 # bytes
adamcrowe242/logprune
convert.py
<reponame>adamcrowe242/logprune<filename>convert.py # This program will convert logrotate style logs into compressed logs import sys, main, os, gzip, TestSuite from config import * def run(): if "--test" in sys.argv: testUnit = TestSuite.TestUnit("convert") for directory in testUnit.directoriesT...
adamcrowe242/logprune
LogLevel.py
import main, os class LogLevel: def __init__(self, levelName, directory): self.levelName = levelName self.unzippedFilePath = os.path.join(directory, levelName + ".log") self.zippedFiles = [] self.totalZippedSize = 0 # add each zipped file of the logLevel to the list 'zippe...
iamthad/blendergltf
tests/test_base.py
def test_get_custom_properties(exporters, mocker): blender_data = mocker.MagicMock() vector = mocker.MagicMock() vector.to_list.return_value = [0.0, 0.0, 1.0] blender_data.items.return_value = [ ['str', 'spam'], ['float', 1.0], ['int', 42], ['bool', False], ['vect...
iamthad/blendergltf
blendergltf/exporters/image.py
<reponame>iamthad/blendergltf<gh_stars>100-1000 import base64 import os import struct import zlib import bpy from .base import BaseExporter from .common import ( Buffer, Reference, SimpleID, ) EXT_MAP = {'BMP': 'bmp', 'JPEG': 'jpg', 'PNG': 'png', 'TARGA': 'tga'} class ImageExporter(BaseExporter): ...
iamthad/blendergltf
blendergltf/exporters/material.py
<reponame>iamthad/blendergltf<filename>blendergltf/exporters/material.py<gh_stars>100-1000 from distutils.version import StrictVersion as Version from .base import BaseExporter from .common import ( Reference, ) class MaterialExporter(BaseExporter): gltf_key = 'materials' blender_key = 'materials' @...
iamthad/blendergltf
setup.py
<gh_stars>100-1000 from distutils.core import setup setup( name='blendergltf', packages=['.'] )
iamthad/blendergltf
blendergltf/exporters/skin.py
from distutils.version import StrictVersion as Version import mathutils from .base import BaseExporter from .common import ( Buffer, Reference, SimpleID, get_bone_name, ) def togl(matrix): return [i for col in matrix.col for i in col] class SkinExporter(BaseExporter): gltf_key = 'skins' ...
iamthad/blendergltf
blendergltf/exporters/__init__.py
<gh_stars>100-1000 from .base import BaseExporter from .common import ( Buffer, Reference, SimpleID, get_bone_name, ) from .animation import AnimationExporter from .camera import CameraExporter from .image import ImageExporter from .material import MaterialExporter from .mesh import MeshExporter from ...
iamthad/blendergltf
blendergltf/exporters/base.py
<gh_stars>100-1000 import json def _is_serializable(value): try: json.dumps(value) return True except TypeError: return False _IGNORED_CUSTOM_PROPS = [ '_RNA_UI', 'cycles', 'cycles_visibility', ] # pylint: disable=unused-argument class BaseExporter: gltf_key = '' ...
iamthad/blendergltf
tests/test_scene.py
<filename>tests/test_scene.py def test_scene_default(exporters, state, bpy_scene_default, gltf_scene_default): output = exporters.SceneExporter.export(state, bpy_scene_default) assert output == gltf_scene_default def test_scene_camera( exporters, state, bpy_scene_default, gltf_...
iamthad/blendergltf
tests/test_camera.py
<filename>tests/test_camera.py<gh_stars>100-1000 def test_camera_default(exporters, state, bpy_camera_default, gltf_camera_default): output = exporters.CameraExporter.export(state, bpy_camera_default) assert output == gltf_camera_default def test_camera_ortho(exporters, state, bpy_camera_default): bpy_cam...
iamthad/blendergltf
tests/test_node.py
def test_node_default(exporters, state, bpy_object_default, gltf_node_default): output = exporters.NodeExporter.export(state, bpy_object_default) assert output == gltf_node_default def test_node_camera(exporters, state, bpy_object_default, gltf_node_default, bpy_camera_default): bpy_object_default.type = ...
iamthad/blendergltf
blendergltf/extensions/khr_materials_common.py
import importlib from ..blendergltf import Reference from . import _lights_common if '__IMPORTED__' in locals(): importlib.reload(locals()['_lights_common']) else: __IMPORTED__ = True class KhrMaterialsCommon: ext_meta = { 'name': 'KHR_materials_common', 'url': ( 'https://gi...
iamthad/blendergltf
blendergltf/extensions/khr_lights.py
import importlib from . import _lights_common if '__IMPORTED__' in locals(): importlib.reload(locals()['_lights_common']) else: __IMPORTED__ = True class KhrLights: ext_meta = { 'name': 'KHR_lights', 'url': ( 'https://github.com/andreasplesch/glTF/blob/ec6f61d73bcd58d59d4a4ea...
iamthad/blendergltf
blendergltf/exporters/scene.py
from .base import BaseExporter from .common import ( Reference, ) class SceneExporter(BaseExporter): gltf_key = 'scenes' blender_key = 'scenes' @classmethod def export(cls, state, blender_data): bg_color = blender_data.world.horizon_color[:] if blender_data.world else [0.05]*3 res...
iamthad/blendergltf
blendergltf/filters.py
#!/bin/env python import bpy def visible_only(bpy_data): """ Filter out all the invisible objects """ def visible(obj): return any(obj.is_visible(s) for s in bpy_data['scenes']) bpy_data['objects'] = [obj for obj in bpy_data['objects'] if visible(obj)] return bpy_data def selected_...
iamthad/blendergltf
blendergltf/extensions/khr_materials_unlit.py
class KhrMaterialsUnlit: ext_meta = { 'name': 'KHR_materials_unlit', 'url': ( 'https://github.com/KhronosGroup/glTF/pull/1163' ), 'isDraft': True, } def export(self, state): state['extensions_used'].append('KHR_materials_unlit') # Export material...
iamthad/blendergltf
tests/test_image.py
<gh_stars>100-1000 def test_image_export_reference(exporters, state, bpy_image_default, gltf_image_default): state['settings']['images_data_storage'] = 'REFERENCE' gltf_image_default['uri'] = '../filepath.png' output = exporters.ImageExporter.export(state, bpy_image_default) assert output == gltf_image_...
iamthad/blendergltf
blendergltf/extensions/blender_physics.py
from ..blendergltf import Reference class BlenderPhysics: ext_meta = { 'name': 'BLENDER_physics', 'url': ( 'https://github.com/Kupoman/blendergltf/tree/master/extensions/' 'BLENDER_physics' ), 'isDraft': True, } def export_physics(self, state, obj, ...
iamthad/blendergltf
blendergltf/blendergltf.py
from distutils.version import StrictVersion as Version import functools import itertools import json import struct import bpy import mathutils from .exporters import ( Buffer, Reference, SimpleID, get_bone_name, AnimationExporter, CameraExporter, ImageExporter, MaterialExporter, M...
iamthad/blendergltf
blendergltf/exporters/node.py
<gh_stars>100-1000 from distutils.version import StrictVersion as Version from .base import BaseExporter from .common import ( Reference, SimpleID, get_bone_name, ) class NodeExporter(BaseExporter): gltf_key = 'nodes' blender_key = 'objects' @classmethod def export(cls, state, blender_d...
iamthad/blendergltf
blendergltf/exporters/texture.py
<reponame>iamthad/blendergltf from distutils.version import StrictVersion as Version import bpy from .base import BaseExporter from .common import ( Reference, SimpleID, ) # Texture formats GL_ALPHA = 6406 GL_RGB = 6407 GL_RGBA = 6408 GL_LUMINANCE = 6409 GL_LUMINANCE_ALPHA = 6410 # Texture filtering GL_NEA...
iamthad/blendergltf
tests/test_material.py
<filename>tests/test_material.py from distutils.version import StrictVersion as Version def test_material_default(exporters, state, bpy_material_default, gltf_material_default): output = exporters.MaterialExporter.export(state, bpy_material_default) assert output == gltf_material_default def test_material_1...
iamthad/blendergltf
blendergltf/exporters/mesh.py
from distutils.version import StrictVersion as Version import mathutils from .base import BaseExporter from .common import ( Buffer, Reference, SimpleID, ) OES_ELEMENT_INDEX_UINT = 'OES_element_index_uint' class Vertex: __slots__ = ( "co", "normal", "uvs", "colors",...
iamthad/blendergltf
blendergltf/extensions/_lights_common.py
from distutils.version import StrictVersion as Version from ..blendergltf import Reference from ..exporters import BaseExporter def export_light(light): def calc_att(): constant_factor = 1 linear_factor = 0 quad_factor = 0 if light.falloff_type == 'INVERSE_LINEAR': li...
iamthad/blendergltf
tests/test_texture.py
def test_sampler_export(exporters, bpy_texture_default, gltf_sampler_default): output = exporters.TextureExporter.export_sampler(bpy_texture_default) assert output == gltf_sampler_default def test_sampler_export_mirror_x(exporters, bpy_texture_default, gltf_sampler_default): bpy_texture_default.use_mirror...
iamthad/blendergltf
blendergltf/exporters/common.py
import base64 from distutils.version import StrictVersion as Version import collections import json import math import os import struct import bpy def get_bone_name(bone): return '{}_{}'.format(bone.id_data.name, bone.name) class AnimationPair: def __init__(self, target, action, is_shape_key=False): ...
iamthad/blendergltf
blendergltf/exporters/camera.py
from .base import BaseExporter class CameraExporter(BaseExporter): gltf_key = 'cameras' blender_key = 'cameras' @classmethod def export(cls, state, blender_data): camera_gltf = {} if blender_data.type == 'ORTHO': xmag = 0.5 * blender_data.ortho_scale ymag = xma...
iamthad/blendergltf
tests/test_common.py
<reponame>iamthad/blendergltf def test_get_bone_name(blendergltf, mocker): bone = mocker.MagicMock() bone.name = 'Bone' armature = mocker.MagicMock() armature.name = 'Armature' bone.id_data = armature bone_name = 'Armature_Bone' assert blendergltf.get_bone_name(bone) == bone_name
iamthad/blendergltf
blendergltf/extensions/khr_technique_webgl.py
import base64 import os import re import bpy import gpu LAMP_TYPES = [ gpu.GPU_DYNAMIC_LAMP_DYNVEC, gpu.GPU_DYNAMIC_LAMP_DYNCO, gpu.GPU_DYNAMIC_LAMP_DYNIMAT, gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT, gpu.GPU_DYNAMIC_LAMP_DYNENERGY, gpu.GPU_DYNAMIC_LAMP_DYNENERGY, gpu.GPU_DYNAMIC_LAMP_DYNCOL, gp...
mawanda-jun/3D-mri-brain-features-classification-using-autoencoder-regularization
vae_classifier.py
# Keras implementation of the paper: # 3D MRI Brain Tumor Segmentation Using Autoencoder Regularization # by <NAME>. (https://arxiv.org/pdf/1810.11654.pdf) # Author of this code: <NAME> (https://github.com/IAmSUyogJadhav) from blocks import * from utils import * import torch import torch.nn as nn from collections impo...
mawanda-jun/3D-mri-brain-features-classification-using-autoencoder-regularization
group_norm.py
<reponame>mawanda-jun/3D-mri-brain-features-classification-using-autoencoder-regularization<filename>group_norm.py import torch import torch.nn.init as initializers class GroupNormalization(torch.nn.Module): """Group normalization layer Group Normalization divides the channels into groups and computes within...
mawanda-jun/3D-mri-brain-features-classification-using-autoencoder-regularization
blocks.py
import torch import torch.nn as nn from utils import * # from group_norm import GroupNormalization from collections import OrderedDict # DEVICE = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') class GreenBlock(nn.Module): def __init__(self, in_channels, out_channels, input_side_dim): """ ...
mawanda-jun/3D-mri-brain-features-classification-using-autoencoder-regularization
__init__.py
from vae_classifier import BrainClassifierVAE from losses import VAELoss
mawanda-jun/3D-mri-brain-features-classification-using-autoencoder-regularization
losses.py
<filename>losses.py import torch import torch.nn as nn class GTLoss(nn.Module): """ loss_gt(e=1e-8) ------------------------------------------------------ This function only calculates - L<dice> term of the following equation. (i.e. GT Decoder part loss) L = - L<dice> + weight_L2 ∗ L<L2> + wei...
mawanda-jun/3D-mri-brain-features-classification-using-autoencoder-regularization
utils.py
def calc_same_padding(i, k, s): """ Calculate same padding for convolutions :param i: input size (simpler for squared images) :param k: kernel_size :param s: stride :return: padding for 'same' padding """ return round(((i - 1) * s - i + k) / 2 + 0.1) def calc_conv_shape(i, k, p, s): ...
NMoksnes/gep-onsset
gep_onsset/__init__.py
""" gep-onsset package contains the following modules: - gep-onsset.py : main functions of the model - gep-runner.py : runner is used to calibrate inputs and specify scenario runs """ __version__ = "2019.0" from .gep_onsset import *
NMoksnes/gep-onsset
test/test_code.py
<reponame>NMoksnes/gep-onsset import gep_onsset class Testingfunction(unittest.TestCase): def setUp(self): self.hello_message = "Hello GEP!" def test_prints_hello_package(self): output = gep_onsset.hello() assert(output == self.hello_message)
simewu/top-SAT-solvers-2021
experiment_gen_random_SATs.py
import os import sys import re def terminal(cmd): return os.popen(cmd).read() def run(clauses, literals, num_vars): terminal(f'python3 gen_random_SAT.py {clauses} {literals} {num_vars}') output = terminal('./kissat_gb/build/kissat random_SAT.cnf | grep process-time:') match = re.match('c process-time:\s+[^\s]+...
simewu/top-SAT-solvers-2021
gen_random_SAT.py
<gh_stars>0 #!/usr/bin/python import sys import random clauses = None literals = None num_vars = None if len(sys.argv) == 4: # The file name with two arguments clauses = int(sys.argv[1]) literals = int(sys.argv[2]) num_vars = int(sys.argv[3]) if num_vars == None: print('Random SAT Generator') c...
Anelys/Programaci-n-3
__quiz1__.py
<filename>__quiz1__.py class figura(object): base = 0 altura = 0 def __init__(self, fgeometrica): self.fgeometrica = fgeometrica def formula(self): if self.fgeometrica == 'triangulo': print("El valor del area del Triangulo Rectangulo es:") return self....
Anelys/Programaci-n-3
my_part.py
import re import os class usuariosCodigo (object): def crearArchivoProductos(self): global f f = open('productos.txt', 'w') # arch.close() def validateCode(self, validateCodes): try: f = open('productos.txt', 'r') except FileNotFoundError: ...
Anelys/Programaci-n-3
intento.py
<gh_stars>0 import os import re class usuariosAdministrar (object): def validarPatron (self,campo): patron = '[a-z0-9][a-z0-9]' if re.match(patron,campo): return True else: msn = (input("Valor Invalido!")) return False def validarLogin (sel...
jtanx/ImplicationTable
impchart.py
import sys,os,re, math,atexit #[state, S0, Z0, S1, Z1] # S0:S0/S0,S1/Z1 transition = {} # Cell: {crossed-out, [(pairs)]} print("Implication chart calculator v0.2") print() print("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHA...
jtanx/ImplicationTable
sequential-analysis/seqn.py
import sys,os,re,atexit,math from qm import QuineMcCluskey #Such spaghetti code transition = {} print("Sequential analysis v0.1") print() print("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULA...
mbkupfer/dash-react-table
setup.py
import io import json import os from setuptools import setup with open(os.path.join('dash_react_table', 'package.json')) as f: package = json.load(f) package_name = package["name"].replace(" ", "_").replace("-", "_") description='Dash component for React-Table' # Import the README and use it as the long-descri...
mbkupfer/dash-react-table
dash_react_table/_imports_.py
<reponame>mbkupfer/dash-react-table from .DashReactTable import DashReactTable __all__ = [ "DashReactTable" ]
mbkupfer/dash-react-table
dash_react_table/DashReactTable.py
<filename>dash_react_table/DashReactTable.py # AUTO GENERATED FILE - DO NOT EDIT from dash.development.base_component import Component, _explicitize_args class DashReactTable(Component): """A DashReactTable component. DashReactTable is a decalaritive version of react-table, built for dash. At a minimum, it must...
evoloyeu/leapmotion
leapmotion3d/parser.py
# <NAME> <EMAIL> # parse the coordinates data from the file generated by leapmotion import sys, glob, os,csv def parser2(filename): raw = open(filename) fbname = filename.split('.')[0] pfile = open("../"+fbname+".txt", "w") pFre = open("../statistics/"+fbname+"Stat.txt", "w") csvFp = csv.writer(open("../"+fbname...
dvanderrijst/arXiv-demo-dataset
import.py
#!/usr/bin/env python3 """ Load the data into Weaviate """ import time import yaml from modules.taxanomy import load_taxanomy from modules.taxanomy import add_groups from modules.taxanomy import add_archives from modules.taxanomy import add_categories from modules.metadata import get_metadata from modules.imports imp...
dvanderrijst/arXiv-demo-dataset
test/user_input_test.py
import unittest import weaviate class TestUserInput(unittest.TestCase): def setUp(self) -> None: weaviate_url = "http://localhost:8080" self.client = weaviate.Client(weaviate_url) create_schema.create_schema(schema='project/schema.json', weaviate_url=weaviate_url, overwrite=True) def...
dvanderrijst/arXiv-demo-dataset
modules/metadata.py
<gh_stars>1-10 """ This modules contains general utility functions """ from os import path import zipfile import json import requests def _read_metadata_file(filename: str, max_size: int, skip_n_papers: int) -> list: """ converts and returns the arxiv data set from json to a list """ data = [] ids = ...
dvanderrijst/arXiv-demo-dataset
modules/taxanomy.py
<filename>modules/taxanomy.py """ Load and import taxanomy """ import re import copy import weaviate from bs4 import BeautifulSoup import requests import pandas as pd from modules.utilities import generate_uuid from modules.utilities import check_batch_result def load_taxanomy(config) -> dict: """ load ArXiv ta...
dvanderrijst/arXiv-demo-dataset
modules/imports.py
""" Import routines """ import weaviate from dateutil import parser from modules.utilities import format_journal_name from modules.utilities import format_author_name from modules.utilities import generate_uuid from modules.utilities import check_batch_result from modules.utilities import extract_year from modules.uti...
dvanderrijst/arXiv-demo-dataset
test/import_data_test.py
import unittest import os import weaviate from project import create_schema, import_data, import_taxanomy, helper arguments = { "metadata_file": os.path.join( os.path.dirname( os.path.realpath(__file__)), 'sample-arxiv-metadata-oai.json'), "schema": os.path.join( os.path.dir...
dvanderrijst/arXiv-demo-dataset
test/create_schema_test.py
import unittest import weaviate from project.create_schema import create_schema class TestCreateSchema(unittest.TestCase): def setUp(self) -> None: create_schema(schema='project/schema.json', overwrite=True) self.client = weaviate.Client("http://localhost:8080") def test_schema_created(self)...
dvanderrijst/arXiv-demo-dataset
modules/utilities.py
""" This modules contains general utility functions """ import os import datetime import uuid import re import weaviate from weaviate.tools import WCS DEFAULT_WEAVIATE = 'http://localhost:8080' DEFAULT_MAX_BATCH = 1000 DEFAULT_VERBOSE = False def log(i: str) -> str: """ A simple logger :param i: the log m...
tgbaozkn/seffaflik
seffaflik/elektrik/piyasalar/gop.py
import pandas as __pd import datetime as __dt from multiprocessing import Pool as __Pool import multiprocessing as __mp from functools import reduce as __red import logging as __logging from seffaflik.__ortak.__araclar import make_requests as __make_requests from seffaflik.__ortak import __dogrulama as __dogrulama fro...
tgbaozkn/seffaflik
seffaflik/__ortak/__araclar.py
<gh_stars>0 import requests as __requests from requests import ConnectionError as __ConnectionError from requests.exceptions import HTTPError as __HTTPError, RequestException as __RequestException, Timeout as __Timeout import pandas as __pd import logging as __logging from seffaflik.__ortak.__anahtar import HEADERS fro...
tgbaozkn/seffaflik
seffaflik/elektrik/tuketim.py
import pandas as __pd import datetime as __dt from dateutil import relativedelta as __rd from multiprocessing import Pool as __Pool import multiprocessing as __mp from functools import reduce as __red from seffaflik.__ortak.__araclar import make_requests as __make_requests from seffaflik.__ortak import __dogrulama as ...