예제 #1
0
def stdin(sys_argv):
    """
    Imports Kafka & Cassandra parameters.
    """
    # Sets sensitive variables from ENV file
    try:
        path_home = os.getcwd()
        os.chdir(r"../../util/settings")
        settings = dc.Config(dc.RepositoryEnv(".env"))
        os.chdir(path_home)
    except:
        raise OSError("Cannot import ENV settings. Check path for ENV.")

    # Imports terminal input for simulation & Kafka settings
    try:
        p = {}
        p["spark_name"] = settings.get("SPARK_NAME")
        p["cassandra"] = settings.get("CASSANDRA_MASTER", cast=dc.Csv())
        p["cassandra_key"] = settings.get("CASSANDRA_KEYSPACE")
        p["kafka_brokers"] = settings.get("KAFKA_BROKERS")
        p["kafka_topic"] = settings.get("KAFKA_TOPIC", cast=dc.Csv())
    except:
        raise ValueError("Cannot interpret external settings. Check ENV file.")

    return p
def stdin(sys_argv):
    """
    Imports simulation & Kafka parameters, then assigns battery parameters.
    """
    # Sets sensitive variables from ENV file
    try:
        path_home = os.getcwd()
        os.chdir(r"../../util/settings")
        settings = dc.Config(dc.RepositoryEnv(".env"))
        os.chdir(path_home)
    except:
        raise OSError("Cannot import ENV settings. Check path for ENV.")

    # Imports terminal input for simulation & Kafka settings
    try:
        p = {}
        p["id"] = uu.uuid4()
        p["cycles"] = range(abs(int(sys_argv[2])))
        p["current"] = abs(float(sys_argv[3]))
        p["v_min"] = float(sys_argv[4])
        p["v_range"] = float(sys_argv[5]) - p["v_min"]
        p["kafka_brokers"] = settings.get("KAFKA_BROKERS", cast=dc.Csv())
        p["kafka_topic"] = settings.get("KAFKA_TOPIC")
        p["initial_time"] = dt.datetime.now()
    except:
        raise ValueError("Cannot interpret parameters. Check terminal input.")

    # Imports models from serialized models file
    try:
        os.chdir(r"../../util/models")
        with open("models_charge_discharge.pk", "rb") as pickled_models:
            p["models"] = pk.load(pickled_models)
    except:
        raise OSError("Cannot import models. Check path for models file.")

    # Generates cathode and initial capacity pseudo-randomly
    p["cathode"] = nprnd.choice([
        "W",
        "X",
        "Y",
        "Z",
    ])

    if p["cathode"] == "W":
        p["capacity"] = nprnd.choice(range(5000, 6001))
    elif p["cathode"] == "X":
        p["capacity"] = nprnd.choice(range(9500, 12001))
    elif p["cathode"] == "Y":
        p["capacity"] = nprnd.choice(range(2000, 8001))
    else:
        p["capacity"] = nprnd.choice(range(4500, 9001))
    return p
예제 #3
0
import pandas
import random
import io
import re
import math
from io import BytesIO
from subprocess import Popen, PIPE
import datetime
import multiprocessing as mp
from Bio import SeqIO
from Bio.Alphabet import IUPAC
import decouple
import numpy as np

script_path = os.getcwd()
config = decouple.Config(decouple.RepositoryEnv(script_path + '/conf.env'))
SignalP4_path = config('SIGNALP4')
SignalP5_path = config('SIGNALP5')
Phobius_path = config('PHOBIUS')
LipoP_path = config('LIPOP')
TMHMM_path = config('TMHMM')
TatP_path = config('TATP')
Interpro_path = config('INTERPRO')
PERL5LIB = config('PERL5LIB')

#####

__author__ = 'StefanoGrasso'

parser = argparse.ArgumentParser(
    description='Script to perform a proteomic based consensus prediction of '
예제 #4
0
파일: deploy.py 프로젝트: strub/handin
# --------------------------------------------------------------------
from .base import *

import decouple

# --------------------------------------------------------------------
DOTENV_FILE = '/etc/handin/env'
env_config = decouple.Config(decouple.RepositoryEnv(DOTENV_FILE))

# --------------------------------------------------------------------
DEBUG = True

SECRET_KEY = env_config.get('SECRET_KEY')

PRE_SHARED_SECRET = env_config.get('PRE_SHARED_SECRET')

ALLOWED_HOSTS = env_config.get('ALLOWED_HOSTS',
                               cast=lambda v: [s.strip() for s in v.split()])

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '127.0.0.1:11211',
        'TIMEOUT': 3600,
    }
}

# --------------------------------------------------------------------
# import ldap; from django_auth_ldap.config import LDAPSearch
#
# AUTHENTICATION_BACKENDS = (
예제 #5
0
from textwrap import dedent as ded

import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments as dte
import decouple as dc
import os
import pandas as pd
import plotly.graph_objs as go

## GLOBAL DEFINITIONS
# Sets Cassandra database parameters
path_home = os.getcwd()
os.chdir(r"../../util/settings")
settings = dc.Config(dc.RepositoryEnv(".env"))
os.chdir(path_home)
p_cassandra = settings.get("CASSANDRA_MASTER", cast=dc.Csv())
db_session = Cluster(p_cassandra).connect()

# Sets Table and dropdown options
all_groups = ["W", "X", "Y", "Z"]
all_cycles = [str(x) for x in range(1000)]
table_order = ["id", "group", "cycle", "energy", "percent deviation"]

# Sets Dash application parameters
app = dash.Dash("Charge_Tracker",
                external_stylesheets=[\
                        "https://codepen.io/chriddyp/pen/bWLwgP.css"])
server = app.server
app.layout = html.Div([