repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
JuliusHen/gimli
pygimli/viewer/pv/utils.py
import tempfile import numpy as np import pygimli as pg pv = pg.optImport('pyvista', requiredFor="properly visualize 3D data") def pgMesh2pvMesh(mesh, data=None, label=None): """ pyGIMLi's mesh format is different from pyvista's needs, some preparation is necessary. Parameters ---------- me...
JuliusHen/gimli
pygimli/testing/test_RegionManager.py
<filename>pygimli/testing/test_RegionManager.py<gh_stars>100-1000 #!/usr/bin/env python """ """ import unittest import time import numpy as np import pygimli as pg import pygimli.meshtools as mt from pygimli.frameworks import MeshModelling class TestMod(MeshModelling): def __init__(self, mesh, verbose=True): ...
JuliusHen/gimli
pygimli/physics/ert/importData.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import numpy as np import pygimli as pg def load(fileName, verbose=False, **kwargs): """Shortcut to load ERT data. Import Data and try to assume the file format. Additionally to unified data format we support the wide-spread res2dinv format as w...
JuliusHen/gimli
doc/examples/1_meshing/plot_hybrid-mesh-2d.py
#!/usr/bin/env python # encoding: utf-8 r""" Building a hybrid mesh in 2D ---------------------------- In some cases, the modelling domain may require flexibility in one region and equidistant structure in another. In this short example, we demonstrate how to accomplish this for a two-dimensional mesh consisting of a ...
JuliusHen/gimli
pygimli/testing/test_SparseMatrix.py
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- # write a correct test! import unittest import pygimli as pg import numpy as np class TestSparseMatrix(unittest.TestCase): def test_Convert(self): """ """ colIds = range(10) rowIds = range(10) vals = np.ones...
JuliusHen/gimli
pygimli/core/datacontainer.py
# -*- coding: utf-8 -*- """ Extensions to the core DataContainer class[es]. """ import numpy as np from . logger import deprecated, info, warn, critical, verbose from .core import (RVector3, RVector, IndexArray, DataContainer, DataContainerERT) def __DataContainer_str(self): return "Data: Sensor...
JuliusHen/gimli
pygimli/utils/streams.py
import pygimli as pg def streamline(mesh, field, startCoord, dLengthSteps, dataMesh=None, maxSteps=1000, verbose=False, coords=(0, 1)): """Create a streamline from start coordinate and following a vector field in up and down direction. """ xd, yd, vd = streamlineDir(mesh, field, startCoord,...
JuliusHen/gimli
pygimli/physics/ert/__init__.py
# -*- coding: utf-8 -*- """Direct current electromagnetics This package contains tools, modelling operators, and managers for: * Electrical Resistivity Tomography (ERT) / Induced polarization (IP) * Vertical Electric Sounding (VES) """ import pygimli as pg from .ert import (simulate, estimateError, ...
JuliusHen/gimli
pygimli/utils/__init__.py
# -*- coding: utf-8 -*- """ Useful utility functions. """ from .base import (rms, rmsWithErr, nanrms, createDateTimeString, createfolders, # renamed 20200515 createFolders, createResultFolder, # renamed 20200515 createResultPath, ...
JuliusHen/gimli
pygimli/viewer/mpl/__init__.py
<gh_stars>100-1000 # -*- coding: utf-8 -*- """Matplotlib drawing functions used by `pygimli.viewer`.""" import pygimli as pg import matplotlib # are the following suitable for a drawing package? from .utils import (hold, wait, updateFig, updateAxes, ...
JuliusHen/gimli
pygimli/frameworks/inversion.py
<reponame>JuliusHen/gimli # -*- coding: utf-8 -*- """pyGIMLi - Inversion Frameworks. Basic inversion frameworks that usually needs a forward operator to run. """ import numpy as np import pygimli as pg from pygimli.utils import prettyFloat as pf class Inversion(object): """Basic inversion framework. Change...
JuliusHen/gimli
pygimli/viewer/mpl/modelview.py
<reponame>JuliusHen/gimli # -*- coding: utf-8 -*- """Model viewer functions.""" import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Rectangle from matplotlib.collections import PatchCollection import matplotlib.colors as colors import pygimli as pg from .colorbar import setMappableData...
JuliusHen/gimli
doc/examples/3_dc_and_ip/plot_02_ert_field_data.py
<reponame>JuliusHen/gimli #!/usr/bin/env python # -*- coding: utf-8 -*- r""" ERT field data with topography ------------------------------ Simple example of data measured over a slagdump demonstrating: - 2D inversion with topography - geometric factor generation - topography effect """ # sphinx_gallery_thumbnail_numb...
JuliusHen/gimli
doc/tutorials/2_modelling/plot_5-mod-fem-heat-2d.py
#!/usr/bin/env python # -*- coding: utf-8 -*- r""" Heat equation in 2D ------------------- This tutorial simulates the stationary heat equation in 2D. The example is taken from the pyGIMLi paper (https://cg17.pygimli.org). """ import pygimli as pg import pygimli.meshtools as mt ######################################...
JuliusHen/gimli
pygimli/testing/__init__.py
# coding=utf-8 """ Testing utilities In Python you can call `pygimli.test()` to run all docstring examples. Writing tests for pygimli ------------------------- Please check: https://docs.pytest.org/en/latest/ """ import sys from os.path import join, realpath import matplotlib.pyplot as plt import numpy as np impo...
JuliusHen/gimli
pygimli/testing/test_RValueConverter.py
<filename>pygimli/testing/test_RValueConverter.py #!/usr/bin/env python # -*- coding: utf-8 -*- import sys import unittest import numpy as np import pygimli as pg class TestRVectorMethods(unittest.TestCase): def test_RVector(self): """ implemented in custom_rvalue.cpp""" a = pg.Vector(10) ...
JuliusHen/gimli
pygimli/physics/traveltime/utils.py
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- """Tools for traveltime/refraction tomography.""" import numpy as np import pygimli as pg def createCrossholeData(sensors): """ Create crosshole scheme assuming two boreholes with equal sensor numbers. Parameters ---------- sensors...
JuliusHen/gimli
doc/examples/dev/multi/seismics.py
#!/usr/bin/env python """ Test multi """ import os import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import pygimli as pg from pygimli.solver import parseArgToArray from pygimli.physics.seismics import ricker, solvePressureWave import pygimli.meshtools as mt def createCac...
JuliusHen/gimli
pygimli/physics/traveltime/TravelTimeManager.py
<filename>pygimli/physics/traveltime/TravelTimeManager.py #!/usr/bin/env python # -*- coding: utf-8 -*- """Class for managing first arrival travel time inversions""" import os import numpy as np import matplotlib.pyplot as plt from matplotlib.collections import LineCollection import pygimli as pg from pygimli.framew...
JuliusHen/gimli
pygimli/meshtools/grid.py
<reponame>JuliusHen/gimli<filename>pygimli/meshtools/grid.py # -*- coding: utf-8 -*- """General grid generation and maintenance.""" import os import numpy as np import pygimli as pg from .polytools import polyCreateWorld, syscallTetgen def createGrid(x=None, y=None, z=None, **kwargs): """Create grid style mes...
JuliusHen/gimli
doc/examples/2_seismics/plot_02_crosshole_tomography.py
#!/usr/bin/env python # coding: utf-8 """ Crosshole traveltime tomography ------------------------------- Seismic and ground penetrating radar (GPR) methods are frequently applied to image the shallow subsurface. While novel developments focus on inverting the full waveform, ray-based approximations are still widely u...
JuliusHen/gimli
pygimli/meshtools/__init__.py
<gh_stars>100-1000 # encoding: utf-8 """ Mesh generation and modification. .. note:: Although we discriminate here between grids (structured meshes) and meshes (unstructured), both objects are treated the same internally. """ from pygimli.core import createMesh1D, createMesh1DBlock, createMesh2D, createMesh3...
JuliusHen/gimli
pygimli/physics/SIP/importData.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Import/Export for SIP data.""" import codecs from datetime import datetime import numpy as np import re import pygimli as pg def load(fileName, verbose=False, **kwargs): """Shortcut to load SIP spectral data. Import Data and try to assume the file format. ...
JuliusHen/gimli
pygimli/physics/ert/ertScheme.py
# -*- coding: utf-8 -*- # import matplotlib.pyplot as plt import numpy as np # from numpy import ma import pygimli as pg from pygimli.physics import ert from pygimli.viewer.mpl.colorbar import createColorBarOnly def createData(elecs, schemeName='none', **kwargs): """ Utility one-liner to create a BERT datafile ...
JuliusHen/gimli
pygimli/testing/test_XVector.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import numpy as np import pygimli as pg class TestRVectorMethods(unittest.TestCase): def test_XVectorBasics(self): def testVector(v): for t in v: self.assertEqual(t, 1.0) self.assertEqual(sum(v), 5...
JuliusHen/gimli
pygimli/physics/traveltime/modelling.py
<filename>pygimli/physics/traveltime/modelling.py #!/usr/bin/env python # -*- coding: utf-8 -*- """Modelling classes for managing first arrival travel-time problems""" import numpy as np import pygimli as pg from pygimli.frameworks import MeshModelling from pygimli.viewer.mpl import createColorBar # , updateColorBar...
JuliusHen/gimli
pygimli/physics/ert/ertManager.py
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- """Method Manager for Electrical Resistivity Tomography (ERT)""" import os.path import numpy as np import matplotlib.pyplot as plt import pygimli as pg from pygimli.frameworks import MeshMethodManager from .ertModelling import ERTModelling, ERTModelling...
JuliusHen/gimli
pygimli/viewer/__init__.py
# -*- coding: utf-8 -*- """Interface for 2D and 3D visualizations.""" from .mpl import hold, wait from .showmesh import plt, show, showBoundaryNorm, showMesh from .showmatrix import showMatrix
JuliusHen/gimli
pygimli/frameworks/methodManager.py
<filename>pygimli/frameworks/methodManager.py #!/usr/bin/env python # -*- coding: utf-8 -*- """Method Manager Provide the end user interface for method (geophysical) dependent modelling and inversion as well as data and model visualization. """ import numpy as np import pygimli as pg from pygimli.utils import prett...
PedroAmorim/Photobooth
config-dist.py
<gh_stars>0 # GPIO Config led_pin = 27 # LED btn_pin = 17 # pin for the start button shutdown_btn_pin = 18 # pin for the shutdown button print_btn_pin = 12 # pin for the print button print_led_pin = 13 # pin for the print LED # Config settings to change behavior of photo booth # width of the display monitor monit...
PedroAmorim/Photobooth
tests/playSound.py
#!/usr/bin/env python # -*-coding:utf-8 -* import os import pygame import time # initialize pygame pygame.mixer.pre_init(44100, -16, 2, 2048) # setup mixer to avoid sound lag pygame.init() capture = pygame.mixer.Sound(os.path.dirname(os.path.realpath(__file__)) + "/../camera-shutter-sound.wav") # load sound # Mai...
PedroAmorim/Photobooth
photobooth.py
<filename>photobooth.py #!/usr/bin/env python # -*-coding:utf-8 -* # # Initial project created by <EMAIL> # Current fork made by <NAME> (<EMAIL>) and <NAME> import os import glob import time from time import sleep import traceback import RPi.GPIO as GPIO import picamera # http://picamera.readthedocs.org/en/release-1....
RtKelleher/ServiceNow_Reporting
snow_reporting.py
<reponame>RtKelleher/ServiceNow_Reporting #!/usr/bin/env python3 # encoding: utf-8 """ Python script to create servicenow tickets from hive cases. Reducing the need for duplication in CMS. """ from cortexutils.responder import Responder import requests import yaml import re import json with open("config.yml", "r") as...
lenforiee/LenHTTP
lenhttp/lenhttp.py
import socket import asyncio import os import re import http import gzip import select import signal import json import traceback from .timer import Timer from urllib.parse import unquote from .logger import info, error, warning from typing import Any, Union, Tuple, Dict, Callable, Coroutine, List, Iterabl...
lenforiee/LenHTTP
example_app.py
<reponame>lenforiee/LenHTTP import asyncio from lenhttp import Endpoint, Request, Application, logger async def home_page(request: Request): """Main page of app.""" return "Hello on main page!" async def users(request: Request, user_id: int): """Test function for regex testing.""" return f"Hello user wit...
lenforiee/LenHTTP
setup.py
import setuptools import os with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() if os.name == "nt": raise RuntimeError("You can't install this package on windows machine!") setuptools.setup( name="LenHTTP", version="2.2.7", author="lenforiee", author_em...
guiambros/libratbag
tools/ratbagc.py
# vim: set expandtab shiftwidth=4 tabstop=4: # # Copyright 2017 Red Hat, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights ...
guiambros/libratbag
tools/merge_ratbagd.py
<filename>tools/merge_ratbagd.py #!/usr/bin/env python3 # # vim: set expandtab shiftwidth=4 tabstop=4: # # Copyright 2017 Red Hat, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software witho...
guiambros/libratbag
tools/toolbox.py
<filename>tools/toolbox.py # vim: set expandtab shiftwidth=4 tabstop=4: # # This file is part of libratbag. # # Copyright 2017 Red Hat, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software ...
janosimas/docker-dev
scripts/clang-tidy-diff.py
<reponame>janosimas/docker-dev<gh_stars>0 #!/usr/bin/env python # #===- clang-tidy-diff.py - ClangTidy Diff Checker ------------*- python -*--===# # # The LLVM Compiler Infrastructure # # This file is distributed under the University of Illinois Open Source # License. See LICENSE.TXT for details. # ...
dagger2/new_thrift_site
app/controller/main.py
from flask import ( Blueprint, render_template, redirect, url_for, abort ) bp = Blueprint('main', __name__) @bp.route('/') def index(): return render_template('main/index.html') @bp.route('/events/ezras_exchange') def ezras_exchange(): return render_template('main/happenings.html') @bp.route('/events/m...
dagger2/new_thrift_site
app/controller/pwa.py
<reponame>dagger2/new_thrift_site from flask import ( Blueprint, make_response, send_from_directory ) bp = Blueprint('pwa', __name__, url_prefix='') @bp.route('/manifest.json') def manifest(): return send_from_directory('static', 'manifest.json') # @bp.route('/sw.js') # def service_worker(): # response =...
dagger2/new_thrift_site
wsgi.py
<reponame>dagger2/new_thrift_site from app import create_app app = create_app() if __name__ == "__init__": application.run(host='0.0.0.0')
WTL7/Prac_LogisticRegression
ML_LogisticRegression.py
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns ad_data = pd.read_csv('advertising.csv') print ad_data.head() print ad_data.describe() print ad_data.info() sns.set_style('whitegrid') sns.distplot(ad_data['Age'], kde = False, bins = 30) #sns.jointplot(x = 'Age', y = 'Are...
bowlofstew/vitess
test/vtctld_web_test.py
<filename>test/vtctld_web_test.py #!/usr/bin/env python """A vtctl webdriver test.""" import logging import os from selenium import webdriver import unittest from vtproto import vttest_pb2 from vttest import environment as vttest_environment from vttest import local_database from vttest import mysql_flavor import en...
bowlofstew/vitess
py/vtdb/keyspace.py
<gh_stars>1-10 # Copyright 2013, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """A Vitess keyspace represents a sharded MySQL database.""" import struct from vtdb import keyrange_constants pack_keyspace_id = struct.Struct('!Q...
bowlofstew/vitess
py/vtproto/throttlerservice_pb2.py
<filename>py/vtproto/throttlerservice_pb2.py # Generated by the protocol buffer compiler. DO NOT EDIT! # source: throttlerservice.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _me...
bowlofstew/vitess
test/keyspace_util.py
<filename>test/keyspace_util.py #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2015, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """This module allows you to bring up and tear down keyspaces. """ import os import e...
bowlofstew/vitess
py/vtdb/topology.py
<filename>py/vtdb/topology.py """Deprecated module that holds keyspace / sharding methods.""" # Copyright 2013, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. # DEPRECATED module, just one hardcoded function left, so vtrouting.py ...
bowlofstew/vitess
test/end2end/base_environment.py
<reponame>bowlofstew/vitess """Base environment for full end2end tests. Contains functions that all environments should implement along with functions common to all environments. """ import json from vttest import sharding_utils class VitessEnvironmentError(Exception): pass class BaseEnvironment(object): """B...
bowlofstew/vitess
test/topo_flavor/__init__.py
<filename>test/topo_flavor/__init__.py #!/usr/bin/env python # Copyright 2014, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file.
bowlofstew/vitess
replace_doc_link.py
<reponame>bowlofstew/vitess<gh_stars>1-10 # Copyright 2015, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. # ./replace_doc_link doc_link_dir doc_to_be_replaced # # This tool replaces all links in specified doc by the new links give...
bowlofstew/vitess
test/end2end/vtctl_helper.py
"""Helper module for running vtctl commands. This module allows for retry logic to ensure that vtctl commands are properly executed. This should help reduce flakiness in the sandbox. """ import logging import os import re import subprocess import tempfile import time from vtctl import vtctl_client class VtctlClie...
bowlofstew/vitess
tools/proto3to2.py
#!/usr/bin/env python import sys import re import string syntax = re.compile(r'^\s*syntax\s*=\s*"proto3";') package = re.compile(r'^\s*package\s*(\S+);') missing_optional = re.compile(r'^(\s+)(\S+)(\s+\S+\s*=\s*\S+;)') map_type = re.compile(r'^(\s*)map\s*<(\S+),\s*(\S+)>\s+(\S+)\s*=\s*(\S+);') for line in sys.stdin:...
bowlofstew/vitess
test/tabletmanager.py
<gh_stars>0 #!/usr/bin/env python import json import logging import time import unittest import urllib import urllib2 import MySQLdb from vtproto import topodata_pb2 import environment import utils import tablet from mysql_flavor import mysql_flavor from protocols_flavor import protocols_flavor tablet_62344 = tabl...
bowlofstew/vitess
test/end2end/k8s_environment.py
<reponame>bowlofstew/vitess<filename>test/end2end/k8s_environment.py """Kubernetes environment.""" import json import getpass import logging import os import subprocess import time from vtdb import vtgate_client import base_environment import protocols_flavor import vtctl_helper class K8sEnvironment(base_environmen...
bowlofstew/vitess
test/update_stream.py
#!/usr/bin/env python import logging import time import unittest import environment import tablet import utils from vtdb import dbexceptions from vtdb import proto3_encoding from vtdb import vtgate_client from vtproto import query_pb2 from vtproto import topodata_pb2 from mysql_flavor import mysql_flavor from protoco...
bowlofstew/vitess
test/vtgate_utils_test.py
<gh_stars>1-10 #!/usr/bin/env python # coding: utf-8 """Tests for vtgate_utils.""" import exceptions import time import unittest import utils from vtdb import vtgate_utils def setUpModule(): pass def tearDownModule(): pass class SomeException(exceptions.Exception): pass class AnotherException(exception...
bowlofstew/vitess
py/vttest/init_data_options.py
<reponame>bowlofstew/vitess """Stores options used for initializing the database with randomized data. The options stored correspond to command line flags. See run_local_database.py for more details on each option. """ class InitDataOptions(object): valid_attrs = set([ 'rng_seed', 'min_table_shard_size...
bowlofstew/vitess
py/setup.py
<gh_stars>1-10 # Copyright 2012, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """This is the setup script for the submodules in the Vitess python client. """ from distutils.core import setup setup(name="vitess", packages=...
bowlofstew/vitess
py/vtctl/vtctl_client.py
# Copyright 2014 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """This module defines the vtctl client interface. """ import logging # mapping from protocol to python class. The protocol matches the string # used by vtctlclient a...
bowlofstew/vitess
test/vtctld2_web_test.py
#!/usr/bin/env python """A vtctld2 webdriver test.""" import logging import os from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions from selenium.webdriver.support.wait import WebDriverWait from selenium.common.exceptions import NoSuchEle...
bowlofstew/vitess
examples/demo/run.py
<reponame>bowlofstew/vitess<filename>examples/demo/run.py #!/usr/bin/env python # Copyright 2015 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """This is a demo for V3 features. The script will launch all the processes necessary...
bowlofstew/vitess
test/grpc_protocols_flavor.py
<gh_stars>0 #!/usr/bin/env python """Defines which protocols to use for the gRPC flavor.""" from grpc.framework.interfaces.face import face import protocols_flavor # Now imports all the implementations we need. # We will change this to explicit registration soon. from vtctl import grpc_vtctl_client # pylint: disabl...
bowlofstew/vitess
py/vttest/__init__.py
<reponame>bowlofstew/vitess # Copyright 2015, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. from vttest import environment from vttest import mysql_db_mysqlctl environment.mysql_db_class = mysql_db_mysqlctl.MySqlDBMysqlctl
bowlofstew/vitess
py/vtproto/vtworkerservice_pb2.py
<filename>py/vtproto/vtworkerservice_pb2.py # Generated by the protocol buffer compiler. DO NOT EDIT! # source: vtworkerservice.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _mess...
bowlofstew/vitess
test/automation_vertical_split.py
<reponame>bowlofstew/vitess #!/usr/bin/env python # # Copyright 2016, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. # "unittest" is used indirectly by importing "vertical_split", but pylint does # not grasp this. # Import it expli...
bowlofstew/vitess
py/vtdb/proto3_encoding.py
# Copyright 2015 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """Utility module for proto3-python conversions. This module defines the conversion functions from proto3 to python, and utility methods / classes to convert requests ...
bowlofstew/vitess
py/vtdb/times.py
# times module # # This module provides some Date and Time interface for vtdb # # Use Python datetime module to handle date and time columns. from datetime import date from datetime import datetime from datetime import time from datetime import timedelta from math import modf from time import localtime # FIXME(msolom...
bowlofstew/vitess
py/vttest/mysql_db.py
# Copyright 2015 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """This module defines the interface for the MySQL database. """ class MySqlDB(object): """A MySqlDB contains basic info about a MySQL instance.""" def __init__...
bowlofstew/vitess
py/vtdb/vtgate_cursor.py
<reponame>bowlofstew/vitess # Copyright 2012, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """VTGateCursor, and StreamVTGateCursor.""" import itertools import operator import re from vtdb import base_cursor from vtdb import dbe...
bowlofstew/vitess
test/resharding_bytes.py
#!/usr/bin/env python # # Copyright 2013, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """Re-runs resharding.py with a varbinary keyspace_id.""" from vtdb import keyrange_constants import base_sharding import resharding import ...
bowlofstew/vitess
py/vtdb/keyrange_constants.py
<filename>py/vtdb/keyrange_constants.py # Copyright 2013, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """Constants related to keyspaces and shard names.""" # Keyrange that spans the entire space, used # for unsharded database. ...
bowlofstew/vitess
test/base_sharding.py
#!/usr/bin/env python # # Copyright 2013, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """This module contains a base class and utility functions for sharding tests. """ import struct import logging from vtdb import keyrange_c...
bowlofstew/vitess
py/vtdb/__init__.py
"""This file provides the PEP0249 compliant variables for this module. See https://www.python.org/dev/peps/pep-0249 for more information on these. """ # Copyright 2012, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. # Follows the...
bowlofstew/vitess
test/end2end/local_environment.py
"""A local test environment.""" import base_environment class LocalEnvironment(base_environment.BaseEnvironment): """Environment for locally run instances, CURRENTLY UNSUPPORTED.""" def __init__(self): super(LocalEnvironment, self).__init__() def create(self, **kwargs): pass
bowlofstew/vitess
misc/parse_cover.py
<reponame>bowlofstew/vitess<filename>misc/parse_cover.py #!/usr/bin/python # this is a small helper script to parse test coverage and display stats. import re import sys coverage_pattern = re.compile(r"coverage: (\d+).(\d+)% of statements") no_test_file_count = 0 coverage_count = 0 coverage_sum = 0.0 for line in sy...
bowlofstew/vitess
test/merge_sharding_bytes.py
<filename>test/merge_sharding_bytes.py #!/usr/bin/env python # # Copyright 2013, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """Re-runs merge_sharding.py with a varbinary keyspace_id.""" from vtdb import keyrange_constants imp...
bowlofstew/vitess
test/initial_sharding_l2vtgate.py
#!/usr/bin/env python # # Copyright 2016, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """Re-runs initial_sharding.py with a l2vtgate process.""" import initial_sharding import utils if __name__ == '__main__': initial_shardin...
bowlofstew/vitess
py/vtproto/automationservice_pb2.py
<reponame>bowlofstew/vitess # Generated by the protocol buffer compiler. DO NOT EDIT! # source: automationservice.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from googl...
lukebrez/dfgui
scripts/expt_gui.py
import dfgui import pandas as pd file = 'X:/data/Brezovec/2P_Imaging/20190101_walking_dataset/master_expt.pkl' df = pd.read_pickle(file) dfgui.show(df)
lukebrez/dfgui
dfgui/dfgui.py
#!/usr/bin/env python # -*- encoding: utf-8 from __future__ import absolute_import, division, print_function try: import wx except ImportError: import sys sys.path += [ "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode", "/usr/lib/python2.7/dist-packages" ] import wx import ma...
efrain2010/matchms
matchms/similarity/ModifiedCosine.py
from typing import Tuple from matchms.typing import SpectrumType from .spectrum_similarity_functions import collect_peak_pairs from .spectrum_similarity_functions import get_peaks_array from .spectrum_similarity_functions import score_best_matches class ModifiedCosine: """Calculate 'modified cosine score' between...
efrain2010/matchms
matchms/exporting/save_as_mgf.py
<reponame>efrain2010/matchms from typing import List import pyteomics.mgf as py_mgf from ..Spectrum import Spectrum def save_as_mgf(spectrums: List[Spectrum], filename: str): """Save spectrum(s) as mgf file. :py:attr:`~matchms.Spectrum.losses` of spectrum will not be saved. Arguments: ---------- ...
efrain2010/matchms
tests/test_add_losses.py
<gh_stars>10-100 import numpy import pytest from matchms import Spectrum from matchms.filtering import add_losses def test_add_losses(): """Test if all losses are correctly generated form mz values and precursor-m/z.""" spectrum_in = Spectrum(mz=numpy.array([100, 150, 200, 300], dtype="float"), ...
efrain2010/matchms
tests/test_ParentmassMatchParallel.py
import numpy from matchms import Spectrum from matchms.similarity import ParentmassMatchParallel from matchms.similarity.ParentmassMatchParallel import \ calculate_parentmass_scores def test_parentmass_match(): "Test with default tolerance." spectrum_1 = Spectrum(mz=numpy.array([], dtype="float"), ...
efrain2010/matchms
tests/test_load_from_msp.py
import os import numpy from matchms.importing import load_from_msp def test_load_from_msp(): """Test parse of msp file to sprectum objects""" module_root = os.path.join(os.path.dirname(__file__), "..") spectrums_file = os.path.join(module_root, "tests", "MoNA-export-GC-MS-first10.msp") spectrum = loa...
efrain2010/matchms
matchms/Spectrum.py
<reponame>efrain2010/matchms<filename>matchms/Spectrum.py from typing import Optional import numpy from matplotlib import pyplot from .Spikes import Spikes class Spectrum: """Container for a collection of peaks, losses and metadata For example .. testcode:: import numpy as np from match...
efrain2010/matchms
matchms/importing/__init__.py
from .load_adducts import load_adducts from .load_from_json import load_from_json from .load_from_mgf import load_from_mgf from .load_from_msp import load_from_msp from .load_from_usi import load_from_usi __all__ = [ "load_from_json", "load_from_mgf", "load_from_msp", "load_from_usi", "load_adduct...
efrain2010/matchms
matchms/constants.py
PROTON_MASS = 1.00727645199076
efrain2010/matchms
matchms/filtering/derive_inchikey_from_inchi.py
from ..typing import SpectrumType from ..utils import convert_inchi_to_inchikey from ..utils import is_valid_inchi from ..utils import is_valid_inchikey def derive_inchikey_from_inchi(spectrum_in: SpectrumType) -> SpectrumType: """Find missing InchiKey and derive from Inchi where possible.""" if spectrum_in ...
efrain2010/matchms
matchms/similarity/IntersectMz.py
<filename>matchms/similarity/IntersectMz.py<gh_stars>0 from matchms.typing import SpectrumType class IntersectMz: """Example score for illustrating how to build custom spectra similarity score. IntersectMz will count all exact matches of peaks and divide it by all unique peaks found in both spectrums. ...
efrain2010/matchms
tests/test_save_as_mgf.py
<filename>tests/test_save_as_mgf.py<gh_stars>10-100 import os import tempfile import numpy from matchms import Spectrum from matchms.exporting import save_as_mgf def test_save_as_mgf_single_spectrum(): """Test saving spectrum to .mgf file""" spectrum = Spectrum(mz=numpy.array([100, 200, 300], dtype="float"), ...
efrain2010/matchms
tests/test_cosine_greedy_vectorial.py
import numpy import pytest from matchms import Spectrum from matchms.filtering import normalize_intensities from matchms.similarity import CosineGreedyVectorial def test_cosine_greedy_without_parameters(): spectrum_1 = Spectrum(mz=numpy.array([100, 150, 200, 300, 500, 510, 1100], dtype="float"), ...
efrain2010/matchms
tests/test_correct_charge.py
import numpy from matchms import Spectrum from matchms.filtering import correct_charge def test_correct_charge_no_ionmode(): """Test if no charge is added for empty ionmode.""" spectrum_in = Spectrum(mz=numpy.array([], dtype='float'), intensities=numpy.array([], dtype='float'), ...
efrain2010/matchms
matchms/filtering/repair_inchi_inchikey_smiles.py
<reponame>efrain2010/matchms from ..typing import SpectrumType from .SpeciesString import SpeciesString def repair_inchi_inchikey_smiles(spectrum_in: SpectrumType): if spectrum_in is None: return None spectrum = spectrum_in.clone() # interpret available data and clean each inchi = spectrum....
efrain2010/matchms
matchms/similarity/ParentmassMatchParallel.py
from typing import List import numba import numpy from matchms.typing import SpectrumType class ParentmassMatchParallel: """Return True if spectrums match in parent mass (within tolerance), and False otherwise.""" def __init__(self, tolerance: float = 0.1): """ Parameters: ---------- ...
efrain2010/matchms
tests/test_derive_ionmode.py
import numpy from matchms import Spectrum from matchms.filtering import derive_ionmode def test_derive_ionmode_positive_adduct(): spectrum_in = Spectrum(mz=numpy.array([], dtype="float"), intensities=numpy.array([], dtype="float"), metadata={"adduct": "[M+H]"}...
efrain2010/matchms
matchms/filtering/clean_compound_name.py
import re from ..typing import SpectrumType def clean_compound_name(spectrum_in: SpectrumType) -> SpectrumType: """Clean compound name. A list of frequently seen name additions that do not belong to the compound name will be removed.""" def remove_parts_by_regular_expression(name): """Clean ...
efrain2010/matchms
tests/test_derive_formula_from_name.py
<reponame>efrain2010/matchms<filename>tests/test_derive_formula_from_name.py<gh_stars>0 import numpy from matchms import Spectrum from matchms.filtering import derive_formula_from_name def test_derive_formula_from_name(): spectrum_in = Spectrum(mz=numpy.array([], dtype="float"), intensi...