repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/models/blueprint.py
<reponame>ninadshr/DS-for-Telco<gh_stars>0 import trafaret as t from datarobot.models.api_object import APIObject from ..utils import deprecation_warning, encode_utf8_if_py2 class BlueprintTaskDocument(APIObject): """ Document describing a task from a blueprint. Attributes ---------- title : str ...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/enums.py
<gh_stars>0 def enum(*vals, **enums): """ Enum without third party libs and compatible with py2 and py3 versions. """ enums.update(dict(zip(vals, vals))) return type('Enum', (), enums) CV_METHOD = enum(RANDOM='random', STRATIFIED='stratified', USER='user', ...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/models/imported_model.py
import os import trafaret as t from datarobot.async import wait_for_async_resolution from .api_object import APIObject from ..utils import parse_time class ImportedModel(APIObject): """ Represents an imported model available for making predictions. These are only relevant for administrators of on-premise...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/errors.py
import warnings class AppPlatformError(Exception): """ Raised by :meth:`Client.request()` for requests that: - Return a non-200 HTTP response, or - Connection refused/timeout or - Response timeout or - Malformed request - Have a malformed/missing header in the response. """ ...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/trafaret/keys.py
import trafaret as t def xor_key(first, second, trafaret): trafaret = t.Trafaret._trafaret(trafaret) def check_(value): if (first in value) ^ (second in value): key = first if first in value else second yield first, t.catch_error(trafaret, value[key]), (key,) elif first...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/models/prime_file.py
import trafaret as t from datarobot.models.api_object import APIObject class PrimeFile(APIObject): """ Represents an executable file available for download of the code for a DataRobot Prime model Attributes ---------- id : str the id of the PrimeFile project_id : str the id of th...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/utils/retry.py
<filename>.local/lib/python2.7/site-packages/datarobot/utils/retry.py """This module is not considered part of the public interface. As of 2.3, anything here may change or be removed without warning.""" import itertools import time def wait(timeout, delay=0.1, maxdelay=1.0): """Generate a slow loop, with exponen...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/models/modeljob.py
import trafaret as t from .. import errors from .. import enums from .job import AbstractSpecificJob from ..utils import from_api, retry def wait_for_async_model_creation(project_id, model_job_id, max_wait=enums.DEFAULT_MAX_WAIT): """ Given a Project id and ModelJob id poll for status of process responsi...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/models/reason_codes.py
from datetime import datetime import pandas as pd import trafaret as t from ..utils import encode_utf8_if_py2, get_id_from_response from .api_object import APIObject int_float_string = (t.Type(int) | t.Type(float) | t.String(allow_blank=True)) prediction_values_trafaret = t.Dict({ t.Key('label'): int_float_stri...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/models/__init__.py
<gh_stars>0 # flake8: noqa __all__ = ['blueprint', 'job', 'modeljob', 'model', 'predict_job', 'project', 'featurelist', 'ruleset', 'feature', 'prediction_dataset', 'prime_file'] from .model import Model, PrimeModel, BlenderModel, DatetimeModel, FrozenModel, ModelParameters from .modeljob import ModelJob fr...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/ext/__init__.py
# -*- coding: utf-8 -*- """ ext ~~~~~~~~~ Borrowed very liberally from flask.ext :copyright: (c) 2015 by <NAME>. :license: BSD, see LICENSE for more details. """ def setup(): from ..exthook import ExtensionImporter importer = ExtensionImporter(['datarobot_%s'], __name__) importer.inst...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/helpers/__init__.py
<reponame>ninadshr/DS-for-Telco from .partitioning_methods import * # noqa class AdvancedOptions(object): """ Used when setting the target of a project to set advanced options of modeling process. Parameters ---------- weights : string, optional The name of a column indicating the weight...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/models/model.py
from datetime import datetime import webbrowser import six import trafaret as t from .api_object import APIObject from datarobot.models.ruleset import Ruleset from ..utils import from_api, get_id_from_response, encode_utf8_if_py2, parse_time from ..utils.deprecation import deprecated, deprecation_warning class Mode...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/utils/sourcedata.py
import os import pandas as pd import six from .. import errors def dataframe_to_buffer(df): """Convert a dataframe to a serialized form in a buffer Parameters ---------- df : pandas.DataFrame The data to serialize Returns ------- buff : StringIO() The data. The descript...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/utils/deprecation.py
<reponame>ninadshr/DS-for-Telco """This module is not considered part of the public interface. Anything here may change or be removed without warning.""" import warnings import functools from ..errors import DataRobotDeprecationWarning def deprecation_warning(subject, deprecated_since_versio...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/trafaret/lib.py
import sys py3 = sys.version_info[0] == 3 def py3metafix(cls): if not py3: return cls else: newcls = cls.__metaclass__(cls.__name__, (cls,), {}) newcls.__doc__ = cls.__doc__ return newcls
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/models/featurelist.py
import six import trafaret as t from datarobot.models.api_object import APIObject from datarobot.utils import deprecation_warning from ..utils import encode_utf8_if_py2 class Featurelist(APIObject): """ A set of features used in modeling Attributes ---------- id : str the id of the featureli...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/models/predict_job.py
<gh_stars>0 import trafaret as t from .. import errors from ..enums import JOB_TYPE, PREDICT_JOB_STATUS, DEFAULT_MAX_WAIT from .job import AbstractSpecificJob from ..utils import ( deprecated, raw_prediction_response_to_dataframe, recognize_sourcedata, get_id_from_response, from_api, retry, ) ...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/models/project.py
<gh_stars>0 import collections import webbrowser import six import trafaret as t from datarobot.models.api_object import APIObject from .. import errors from ..enums import (LEADERBOARD_SORT_KEY, AUTOPILOT_MODE, VERBOSITY_LEVEL, QUEUE_STATUS, DEFAULT_READ_TIMEOUT, DEFAULT_MAX...
ninadshr/DS-for-Telco
.local/lib/python2.7/site-packages/datarobot/client.py
<reponame>ninadshr/DS-for-Telco<gh_stars>0 import logging import os import warnings import yaml from distutils.version import LooseVersion from .rest import RESTClientObject, DataRobotClientConfig from ._version import __version__ from .errors import ClientError logger = logging.getLogger(__package__) __all__ = ('...
jfelipesouza/Invasores-do-python
PyInvaders/pyinvaders.py
<reponame>jfelipesouza/Invasores-do-python # coding: utf-8 from random import choice, randint from math import ceil import pygame import os # Variáveis globais que são necessárias em diversos momentos #### Cores #### #### (R, G, B) #### WHITE = (255, 255, 255) RED = (255, 0, 0) BLACK = (0, 0, 0) GREEN...
jdn5126/CoverageChecker
example/lib.py
<gh_stars>0 '''Example class library.''' class Foo(object): def __init__(self, x, y): self.x = x self.y = y def getX(self): return self.x def getY(self): return self.y
jdn5126/CoverageChecker
example/test.py
<reponame>jdn5126/CoverageChecker #!/usr/bin/env python '''Example test driver.''' import unittest # Import from top-level or from this directory try: from lib import Foo except ImportError: from example.lib import Foo class TestFooCoverage(unittest.TestCase): def test_foo(self): print( 'TestFooC...
jdn5126/CoverageChecker
coveragecheck/coveragecheck.py
#!/usr/bin/env python ''' The purpose of this script is to validate lines added in diff against coverage report. Diff is provided as script input, either as a file or from stdin. Diff must be in "unified diff format" for accurate parsing. Coverage report is provided as an input file. Report must be in JSON format, and...
SingularitySurfer/colorlight_pulsegen
adc_out.py
<gh_stars>0 #!/usr/bin/env python3 # This file is Copyright (c) 2020 <NAME> <<EMAIL>> # License: BSD import os import argparse import sys from migen import * from migen.genlib.misc import WaitTimer from migen.genlib.resetsync import AsyncResetSynchronizer from litex_boards.platforms import colorlight_5a_75b from l...
SingularitySurfer/colorlight_pulsegen
scripts/pulsegen_script.py
<filename>scripts/pulsegen_script.py<gh_stars>0 #!/usr/bin/env python3 import time import numpy as np from litex import RemoteClient wb = RemoteClient() wb.open() print("Pulsegen Output...") n = 128 # fft size r = 200 # interpolation rate width_d = 16 # data width data = [0] * n data[7] = 16000 data[6] = -800...
SingularitySurfer/colorlight_pulsegen
pulsegen_main.py
#!/usr/bin/env python3 # This file is Copyright (c) 2020 <NAME> <<EMAIL>> # License: BSD import os import argparse import sys from migen import * from migen.genlib.misc import WaitTimer from migen.genlib.resetsync import AsyncResetSynchronizer from litex_boards.platforms import colorlight_5a_75b from litex.soc.cor...
SingularitySurfer/colorlight_pulsegen
pulsegen.py
# SingularitySurfer 2020 import numpy as np from migen import * from misoc.interconnect.stream import Endpoint from litex.soc.interconnect.csr import * from Phaser_STFT_Pulsegen.super_interpolator import SuperInterpolator from Phaser_STFT_Pulsegen.fft_generator_migen import Fft class Pulsegen(Module, AutoCSR): ...
SingularitySurfer/colorlight_pulsegen
scripts/sine_out.py
#!/usr/bin/env python3 import time import numpy as np from litex import RemoteClient wb = RemoteClient() wb.open() # # # x = np.linspace(0,2 * np.pi, 1000) sine = (2**15 * np.sin(x)) + 2**15 sine = sine.astype('int').tolist() print("artistic sine output...") i = 0 while(1): i = (i + 1) % 1000 wb.regs.dac...
OnlineS3/6.3.-Balanced-scorecard
bscapp/migrations/0003_auto_20170901_1641.py
<gh_stars>0 # -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-09-01 15:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bscapp', '0002_auto_20170901_1234'), ] operations = [ migration...
OnlineS3/6.3.-Balanced-scorecard
bscapp/migrations/0004_auto_20171002_1216.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-10-02 11:16 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('bscapp', '0003_auto_20170901_1641'), ] operations ...
OnlineS3/6.3.-Balanced-scorecard
bscapp/models.py
<filename>bscapp/models.py from __future__ import unicode_literals from django.db import models class Scorecard(models.Model): user_email = models.CharField(max_length=100) scorecard_name = models.CharField(max_length=100) share_id = models.CharField(max_length=40) share_permissions = models.IntegerF...
OnlineS3/6.3.-Balanced-scorecard
bscapp/urls.py
<reponame>OnlineS3/6.3.-Balanced-scorecard from django.conf.urls import url from . import views urlpatterns = [ url(r'^guide/$', views.guide, name='bscapp_guide'), url(r'^access/$', views.access, name='bscapp_access'), url(r'^related/$', views.related, name='bscapp_related'), url(r'^loginview/$', views.login_view...
OnlineS3/6.3.-Balanced-scorecard
bscapp/views.py
<reponame>OnlineS3/6.3.-Balanced-scorecard from django.shortcuts import render,redirect from django.http import HttpResponse, FileResponse,Http404 from django.template import loader from django.contrib.auth import authenticate,login,logout import os #UNCOMMENT FOR LINUX #from weasyprint import HTML, CSS from .models ...
OnlineS3/6.3.-Balanced-scorecard
bscapp/migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-06-28 14:07 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Crea...
OnlineS3/6.3.-Balanced-scorecard
bscapp/apps.py
from __future__ import unicode_literals from django.apps import AppConfig class BscappConfig(AppConfig): name = 'bscapp'
YusukeSuzuki/castanea2
tests/layers.py
import unittest import tensorflow as tf import castanea2.layers as layers class TestLayers(unittest.TestCase): def test_conv2d(self): x = tf.placeholder(tf.float32, shape=(32, 128, 128, 3)) y = layers.conv2d(x, 3, 32) def test_equalized_conv2d(self): x = tf.placeholder(tf.float32, shap...
YusukeSuzuki/castanea2
normalizers/localresponse.py
<filename>normalizers/localresponse.py import tensorflow as tf def karass_local_response_normalization(x, eps=1e-8): with tf.name_scope('karass_local_response_normalization'): return x / tf.sqrt(tf.reduce_mean(x*x, axis=-1, keep_dims=True) + eps) def local_response_normalization(x, method='karass', **kwar...
YusukeSuzuki/castanea2
utils/__init__.py
<filename>utils/__init__.py import tensorflow as tf class WithNone: def __enter__(self): pass def __exit__(self,t,v,tb): pass def device_or_none(x): return WithNone() if x is None else tf.device(x) def get_conv2d_kernel_size(kernel_size): if type(kernel_size) in [list, tuple] and len(kernel_size) ...
YusukeSuzuki/castanea2
layers/__init__.py
<reponame>YusukeSuzuki/castanea2<filename>layers/__init__.py # __init__.py from .conv2d import *
YusukeSuzuki/castanea2
layers/statistics.py
<filename>layers/statistics.py import tensorflow as tf def karras_minibatch_statistics(x): with tf.name_scope('karras_minibatch_statistics'): xs = x.get_shape().as_list() m, v = tf.nn.moments(x, axes=[0,3], keep_dims=True) avg_sdev = tf.reduce_mean(tf.sqrt(v), axis=3, keep_dims=True) ...
YusukeSuzuki/castanea2
initializers/xavier.py
import tensorflow as tf from castanea2.utils import get_conv2d_kernel_size def _initializer_constant(size, uniform=False): s = 6. if uniform else 2. return tf.sqrt(s/size) def _initializer(size, uniform=False, span=None, seed=None): stddev = _initializer_constant(size, uniform) span = span or [-1., 1...
YusukeSuzuki/castanea2
train/__init__.py
<filename>train/__init__.py import tensorflow as tf def average_gradients(tower_grads): average_grads = [] with tf.name_scope('average_gradients'): for grad_and_vars in zip(*tower_grads): grads = [] for g, u in grad_and_vars: expanded_g = tf.expand_dims(g,0) ...
YusukeSuzuki/castanea2
activations/__init__.py
import tensorflow as tf def swish(x, beta=1.): return x * tf.nn.sigmoid(x*beta) def lrelu(x, beta=1e-2): return tf.maximum(x * beta, x) def pseud_tanh(x, beta1=1e-2, beta2=1e-0): return tf.minimum(beta1*(x+beta2),tf.maximum(beta1*(x-beta2), x)) def pseud_sigmoid(x, beta1=1e-2, beta2=1e-0): retur...
YusukeSuzuki/castanea2
layers/conv2d.py
<filename>layers/conv2d.py import tensorflow as tf from castanea2.utils import device_or_none, get_conv2d_kernel_size from castanea2.initializers.xavier import xavier_initializer_conv2d, xavier_constant_conv2d def conv2d( x, kernel_size, out_channels, strides=[1,1,1,1], padding='SAME', ...
labrandr/Sony-PS
base_update.py
<gh_stars>0 import psycopg2 con = psycopg2.connect( database="Psn_game_base", user="postgres", password="<PASSWORD>", host="127.0.0.1", port="5432" ) cur = con.cursor() cur.execute("SELECT game_title FROM public.psn_games_description ") title_list = cur.fetchall() for title in title_list: tit...
labrandr/Sony-PS
data_output.py
import matplotlib as mpl import matplotlib.pyplot as plt import psycopg2 con = psycopg2.connect( database="Psn_game_base", user="postgres", password="<PASSWORD>", host="127.0.0.1", port="5432" ) cur = con.cursor() title = input('Enter the title: ').lower() try: cur.execute("SELECT id FROM pub...
labrandr/Sony-PS
ps_store_parser.py
<reponame>labrandr/Sony-PS import requests from bs4 import BeautifulSoup import lxml import datetime def get_pages_count(url, headers): store_page = requests.get(url, headers=headers) soup = BeautifulSoup(store_page.text, 'lxml') pages_info = soup.find('div', {'class': 'grid-footer-controls'}) \ ....
labrandr/Sony-PS
add_data_in_tables.py
<reponame>labrandr/Sony-PS<gh_stars>0 import datetime import ps_store_parser as psp import psycopg2 url = 'https://store.playstation.com/ru-ru/grid/STORE-MSF75508-PS4CAT/' headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Firefox/45.0' } current_date = (date...
labrandr/Sony-PS
create_tables_in_database.py
<filename>create_tables_in_database.py<gh_stars>0 import psycopg2 con = psycopg2.connect( database="Your_base_name", user="postgres", password="<PASSWORD>", host="127.0.0.1", port="5432" ) cur = con.cursor() cur.execute('''CREATE TABLE psn_games_description (id SERIAL PRIMARY KEY NOT NULL, ...
isidoreduc/recipees-api
app/core/tests/test_models.py
<gh_stars>0 from django.test import TestCase from django.contrib.auth import get_user_model class ModelTests(TestCase): """check successfull user creation""" def test_create_user_with_email(self): email = '<EMAIL>' password = '<PASSWORD>' user = get_user_model().objects.create_user( ...
rjleveque/fema_source_filter
hazard_products/hc_plot_run.py
<filename>hazard_products/hc_plot_run.py from hazard_curves_2Dgrid_plot import hazard_curves_2Dgrid_plot from hazard_curves_transect_plot import hazard_curves_transect_plot from numpy import array,save,loadtxt,linspace from numpy import integer,size import matplotlib.pyplot as plt import os #### The program produce...
rjleveque/fema_source_filter
geoclaw_postprocess/compute_dtopo_proxies.py
""" Compute the dtopo proxies based on the dtopo files for each run. Uses the GeoClaw output for each run. """ from pylab import * import os,sys from clawpack.geoclaw import fgmax_tools, topotools resolution = 'coarse' # should not matter, we only use the dtopo files! # Which cases to process: Mw_list = ['8.6', '...
rjleveque/fema_source_filter
hazard_products/make_haz.py
<gh_stars>0 import os,sys from numpy import integer, size from numpy import array, zeros, linspace, shape, nan, nanmax from numpy import ma, where from numpy import load, save, loadtxt ## Not used at the moment def combine_prob(p1,p2): """Returns the probability that event 1 or 2 happens""" return 1. - (1-p1)*...
rjleveque/fema_source_filter
DataFiles/plotCCtopo.py
""" Shows how to plot the CCtopo grid as contours """ from pylab import * from clawpack.geoclaw.topotools import Topography # Read topography for contour lines: CCtopo = Topography() CCtopo.read('../DataFiles/CCtopo_1_3sec.tt3',3) contour(CCtopo.X, CCtopo.Y, CCtopo.Z, arange(0,21,2), colors='k')
rjleveque/fema_source_filter
hazard_products/make_scenario.py
##### To begin, a project directory (called projectdir) already exists with a subdirectory #### ##### called scenarios_1106 where this program can add one or more scenario directories. #### ##### The master weights for the KL probabilities have been copied from a previous step to #### ##### the file called pro...
rjleveque/fema_source_filter
geoclaw_postprocess/make_npy_files_Mw.py
<reponame>rjleveque/fema_source_filter """ Run this code to make fine_runs and coarse_runs npy files from the fgmax stored from each run. Can also make npy files for gauges, not currently used. """ from pylab import * import os,sys,glob from clawpack.geoclaw import fgmax_tools import clawpack.pyclaw.gauges as gaug...
rjleveque/fema_source_filter
hazard_products/hazard_curves_2Dgrid_plot.py
<filename>hazard_products/hazard_curves_2Dgrid_plot.py """ Usage: >>> from hazard_curves_2Dgrid_plot import hazard_curves_2Dgrid_plot where for example INPUT: hazard_curves_file = the .npy file used for the plots: P1 P2 P3 PNzeta fixed_grid_file = file with x y B in colms, a .np...
rjleveque/fema_source_filter
geoclaw_analysis/plot_fgmax_grid_all_runs_Mw.py
<gh_stars>0 """ Plot the fgmax grid results """ import matplotlib matplotlib.use('Agg') # for non-interactive from pylab import * import os,sys from clawpack.geoclaw import fgmax_tools from clawpack.geoclaw.topotools import Topography from clawpack.geoclaw.geoplot import discrete_cmap_1 save_png = True if save_pn...
rjleveque/fema_source_filter
hazard_products/compare_to.py
##### Compares the .npy files in the run_num_list in the directory compare_dir to the #### ##### corresponding .npy file in the directory to_dir. The to_dir can be for either a fine #### ##### grid run or a coarse grid run. If fine, Ctitle='fine'; otherwise, Ctitle='coarse'. #### ##### The title f...
rjleveque/fema_source_filter
geoclaw_analysis/compute_etamax.py
""" Compute etamax, etamean etc. needed by plot_comparisons.py """ from pylab import * import os,sys from clawpack.geoclaw import fgmax_tools # Which cases to process: resolution_list = ['coarse','fine'] Mw_list = ['8.6', '8.8','9.0','9.2'] run_list = range(100) if 0: # for testing: resolution_list = ['coa...
rjleveque/fema_source_filter
hazard_products/hc_compare_run.py
<reponame>rjleveque/fema_source_filter from hazard_curves_2Dgrid_compare import hazard_curves_2Dgrid_compare from hazard_curves_transect_compare import hazard_curves_transect_compare from numpy import array,loadtxt,linspace from numpy import integer,size import matplotlib.pyplot as plt import os,sys ###############...
rjleveque/fema_source_filter
hazard_products/make_pseudo_dirs.py
<filename>hazard_products/make_pseudo_dirs.py ##### Makes all the pseudo run directories for a particular pseudo strategy ##### User needs to choose below which pseudoname is being used for this run. ##### ##### To run: python make_pseudo_dirs.py (run from $FEMA/ptha_tools directory) ##### import os,sys projectdir =...
rjleveque/fema_source_filter
hazard_products/hazard_curves_2Dgrid_compare.py
""" Usage: >>> from hazard_curves_2Dgrid_compare import hazard_curves_2Dgrid_compare where for example INPUT: hazard_curves_file = the .npy file used for the plots: P1 P2 P3 PNzeta fixed_grid_file = file with x y B in colms, a .npy file (for the FEMA project, B is B0, in...
rjleveque/fema_source_filter
geoclaw_driver/rcrom.py
<reponame>rjleveque/fema_source_filter<filename>geoclaw_driver/rcrom.py import os import numpy as np from clawpack.geoclaw import dtopotools import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as pl import pickle import time, datetime # ==================================================================...
rjleveque/fema_source_filter
hazard_products/hazard_curves_transect_plot.py
""" Usage: >>> from hazard_curves_transect_plot import hazard_curves_transect_plot where for example INPUT: hazard_curves_file = the .npy file used for the plots: P1 P2 P3 PNzeta fixed_grid_file = file with x y B in colms, a .npy file (for the FEMA project, B is B0, ini...
rjleveque/fema_source_filter
hazard_products/hc_make_haz_run.py
############################################################################### from make_haz import hazard_curves_calcv ############################################################################### import os,sys from numpy import integer, size from numpy import array, zeros, linspace, shape, ndim, nan from numpy im...
rjleveque/fema_source_filter
geoclaw_driver/run_CC_CSZ_South.py
from clawpack.geoclaw import dtopotools import os import numpy as np try: CLAW = os.environ['CLAW'] except: raise Exception("*** Must first set CLAW enviornment variable") try: import rcrom except: raise Exception("*** rcrom.py not in path: set PYTHONPATH") # Scratch directory for storing topo an...
rjleveque/fema_source_filter
hazard_products/hazard_curves_transect_compare.py
""" Usage: >>> from hazard_curves_transect_compare import hazard_curves_transect_compare where for example INPUT: hazard_curves_file = the .npy file used for the plots: It is a directory of .npy files used for comparisons of the scenarios on this particular transect and has the f...
rjleveque/fema_source_filter
geoclaw_analysis/kmeans_cluster.py
""" k-means clustering based on cluster_vars, e.g. dtopo_proxies or coarse_mod_eta """ import matplotlib matplotlib.use('Agg') # for non-interactive from pylab import * try: from sklearn.cluster import KMeans except: print "You need to install sklearn first" all_runs_dir = '../geoclaw_output/all_runs_npy_f...
rjleveque/fema_source_filter
hazard_products/pseudo_create.py
#### This program turns the 400 coarse_mod .npy files #### into the 400 pseudo fine .npy files. For the 20 (or 40) centroids #### the pseudo files will be the fine .npy files. #### In the USER INPUT, the cluster_file used to do this is specified, #### as well as the pseudoname indicating which directory to put the ###...
rjleveque/fema_source_filter
hazard_products/make_coarse_mod_dirs.py
<gh_stars>0 ##### Makes all the coarse_mod directories ##### ##### To run: python make_coarse_mod_dirs.py (run from $FEMA/ptha_tools) ##### import os,sys projectdir = os.environ['FEMA'] #dir86 = projectdir + '/all_runs_npy_files_new/coarse_mod_8.6_runs' #dir88 = projectdir + '/all_runs_npy_files_new/coarse_mod_8.8...
rjleveque/fema_source_filter
geoclaw_analysis/collect_all_realizations.py
""" Make html file of all realizations slip, dtopo, hmax together TODO: dtopo_plot.png and subfaults_plot.png must be moved from each geoclaw_output run directory to the png_files directory. """ import os png_files = os.path.abspath('../png_files') html_file = 'all_realizations_with_hmax.html' html = open(html_fi...
rjleveque/fema_source_filter
hazard_products/compare_hmaxplots.py
<gh_stars>0 ##### Comparing the hmax data in all the .npy files in the run_num_list of the compare_dir_list to ### ##### the corresponding fine grid hmax data in the .npy file in the to_dir list. Note that all ### ##### or part of the runs for a given Mw category can be compared with one execution of this pgm ###...
rjleveque/fema_source_filter
geoclaw_analysis/plot_scatter_for_report.py
""" Plot scatter plots comparing various things. Need to first run compute_etamax.py to create files with etamin, etamean, etamax """ import matplotlib matplotlib.use('Agg') # for non-interactive from pylab import * import os save_png = True if save_png: png_files = os.path.abspath('../png_files') os.sys...
rjleveque/fema_source_filter
svd_strategy/svd_coarse_fine.py
<filename>svd_strategy/svd_coarse_fine.py from __future__ import print_function from clawpack.geoclaw import fgmax_tools import matplotlib as mpl mpl.use('Agg') label_size = 14 mpl.rcParams['xtick.labelsize'] = label_size mpl.rcParams['ytick.labelsize'] = label_size import matplotlib.pylab as pl import os, sys impo...
rjleveque/fema_source_filter
geoclaw_driver/make_plots_all.py
<gh_stars>0 import os,sys # create plots for all runs driver_home = os.getcwd() output_dir = '../geoclaw_output' setplot_ffname = os.path.join(redclaw_home,'setplot.py') def make_plot(arg, dirname, fnames): if 'run_' in dirname: cmd_list = ['cd ' + dirname 'cp ' + setplot_ffname + '...
rjleveque/fema_source_filter
geoclaw_postprocess/make_B0.py
""" Create files such as fine_xyB0_fg1.npy that should be moved to all_runs_npy_files directory """ from pylab import * from clawpack.geoclaw import fgmax_tools import os resolution_list = ['coarse','fine'] geoclaw_output = os.path.abspath('../geoclaw_output') os.chdir(geoclaw_output) all_runs_dir = os.path.abspath...
rjleveque/fema_source_filter
hazard_products/coarse_fix.py
<filename>hazard_products/coarse_fix.py #### This program creates the coarse_mod .npy files from the coarse .npy files #### and the coarse and fine bathymetry files. An output text file called #### output.coarse_fix_all has comparison information. #### #### The user chooses below which coarse .npy files are being used...
rjleveque/fema_source_filter
hazard_products/cluster_event_probs_make.py
<reponame>rjleveque/fema_source_filter<filename>hazard_products/cluster_event_probs_make.py ################################################# #### This program creates the event probs #### for the clustered data stored in the cluster_file #### with associated master probs stored in the #### master_prob_wts_file. The ou...
rjleveque/fema_source_filter
geoclaw_analysis/plot_coarse_fine_scatter.py
<reponame>rjleveque/fema_source_filter """ Plot scatter plots comparing various things. Need to first run compute_etamax.py to create files with etamin, etamean, etamax """ import matplotlib matplotlib.use('Agg') # for non-interactive from pylab import * import os save_png = True if save_png: png_files = os.p...
rjleveque/fema_source_filter
geoclaw_analysis/plot_fgmax_transects_all_runs_Mw.py
""" Plot all the transect cross sections together. """ import matplotlib matplotlib.use('Agg') # for non-interactive from pylab import * import os,sys from clawpack.geoclaw import fgmax_tools save_png = True if save_png: png_files = os.path.abspath('../png_files') os.system('mkdir -p %s' % png_files) al...
iotbzh/meta-zephyr
lib/oeqa/utils/qemuzephyrrunner.py
<reponame>iotbzh/meta-zephyr # Copyright (C) 2015-2017 Intel Corporation # # Released under the MIT license (see COPYING.MIT) # This module provides a class for starting qemu images. # It's used by testimage.bbclass. import subprocess import os import time import signal import socket import select import bb import te...
iotbzh/meta-zephyr
lib/oeqa/runtime/zephyr.py
<reponame>iotbzh/meta-zephyr<gh_stars>0 import unittest from oeqa.oetest import oeRuntimeTest class ZephyrTest(oeRuntimeTest): def test_boot_zephyr(self): success = False logfile = self.target.qemurunnerlog while True: line = self.target.serial_readline().decode("utf-8") ...
iotbzh/meta-zephyr
lib/oeqa/controllers/zephyrtargetcontrol.py
<reponame>iotbzh/meta-zephyr # Copyright (C) 2016-2017 Intel Corporation # Released under the MIT license (see COPYING.MIT) import os import sys import signal import logging from oeqa.core.target.__init__ import OETarget from oeqa.utils.qemuzephyrrunner import QemuZephyrRunner supported_fstypes = ['elf'] class QemuT...
jasperweiss/NeuralNetwork
main.py
<gh_stars>0 import numpy as np import pickle import csv from PIL import Image import matplotlib.pyplot as plt import time def save(): with open('network_state.pkl', 'wb') as output: network_state = hiddenWeights, outputWeights pickle.dump(network_state, output) output.close() print...
MaKyOtOx/sast-git-leaks
sast_git_leaks/tools/shhgit.py
# -*- coding: utf-8 -*- ''' Sast Git Leaks Copyright 2020 Leboncoin Licensed under the Apache License Written by <NAME> <<EMAIL>> ''' from pathlib import Path from .import ToolAbstract from ..utils import read_csv from .. import logger as logging class Shhgit(ToolAbstract): def __init__(self, data: dict, path: ...
MaKyOtOx/sast-git-leaks
sast_git_leaks.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Sast Git Leaks Copyright 2020 Leboncoin Licensed under the Apache License Written by <NAME> <<EMAIL>> ''' import sys from pathlib import Path import subprocess import argparse from importlib import import_module from config import variables from sast_git_leaks import...
MaKyOtOx/sast-git-leaks
sast_git_leaks/utils.py
# -*- coding: utf-8 -*- ''' Sast Git Leaks Copyright 2020 Leboncoin Licensed under the Apache License Written by <NAME> <<EMAIL>> ''' import csv import json from pathlib import Path from . import logger as logging def read_csv(path: Path): ''' Read csv file and return list of rows ''' logger = loggi...
MaKyOtOx/sast-git-leaks
config/__init__.py
<filename>config/__init__.py ''' Sast Git Leaks Copyright 2020 Leboncoin Licensed under the Apache License Written by <NAME> <<EMAIL>> '''
MaKyOtOx/sast-git-leaks
config/variables.py
<reponame>MaKyOtOx/sast-git-leaks # -*- coding: utf-8 -*- ''' Sast Git Leaks Copyright 2020 Leboncoin Licensed under the Apache License Written by <NAME> <<EMAIL>> ''' from pathlib import Path from uuid import uuid4 CONFIG_PATH = Path(__file__).parent DATA_PATH = CONFIG_PATH / '..' / 'data' REPORT_PATH = CONFIG_PATH...
MaKyOtOx/sast-git-leaks
sast_git_leaks/tools/gitleaks.py
<gh_stars>0 # -*- coding: utf-8 -*- ''' Sast Git Leaks Copyright 2020 Leboncoin Licensed under the Apache License Written by <NAME> <<EMAIL>> ''' from pathlib import Path import re from .import ToolAbstract from ..utils import read_json from .. import logger as logging class Gitleaks(ToolAbstract): _min_number_...
bkomac/WiFiManager
wifimgr.py
<reponame>bkomac/WiFiManager import network import socket import ure import time ap_ssid = "WifiManager" ap_password = "<PASSWORD>" ap_authmode = 3 # WPA2 NETWORK_PROFILES = 'wifi.dat' wlan_ap = network.WLAN(network.AP_IF) wlan_sta = network.WLAN(network.STA_IF) server_socket = None def get_connection(): """...
cgutierr3z/proyecto-eees
eees/forms.py
<reponame>cgutierr3z/proyecto-eees<gh_stars>0 from django import forms from django.contrib.auth.models import User from .models import * from django.contrib.auth.forms import UserCreationForm, UserChangeForm, ReadOnlyPasswordHashField from django.contrib.auth.models import Group TIPO_DOC_LIST = [ ('CEDULA CUIDADAN...
cgutierr3z/proyecto-eees
eees/urls.py
from django.conf.urls import url from . import views app_name = 'eees' urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^acceso/$', views.login, name='login'), url(r'^salir/$', views.logout, name='logout'), url(r'^registro/$', views.signup, name='signup'), url(r'^restablecer-password/...
cgutierr3z/proyecto-eees
eees/migrations/0004_auto_20170918_1534.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-09-18 20:34 from __future__ import unicode_literals from django.conf import settings import django.contrib.auth.models from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ...
cgutierr3z/proyecto-eees
eees/models.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models # Create your models here. from django.contrib.auth.models import AbstractUser import datetime #Modelo Departametos class Departamento(models.Model): class Meta: verbose_name = "Departamento" verbose_name...
cgutierr3z/proyecto-eees
eees/migrations/0007_auto_20170919_1624.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-09-19 21:24 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('eees', '0006_auto_20170918_1627'), ] operations = ...
cgutierr3z/proyecto-eees
eees/admin.py
<gh_stars>0 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin # Register your models here. from .models import * admin.site.register(Departamento) admin.site.register(Municipio) admin.site.register(Colegio) admin.site.register(Grupo) admin.site.register(Usuario) admin....
cgutierr3z/proyecto-eees
eees/migrations/0008_auto_20170919_2135.py
<filename>eees/migrations/0008_auto_20170919_2135.py # -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-09-20 02:35 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('eees', '0007_auto_20170919_1624'), ...