How to use the bluesky.settings.set_variable_defaults function in bluesky

To help you get started, we’ve selected a few bluesky examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TUDelft-CNS-ATM / bluesky / bluesky / tools / plugin.py View on Github external
""" Implementation of BlueSky's plugin system. """
import ast
from os import path
import sys
from glob import glob
import imp
import bluesky as bs
from bluesky import settings
from bluesky.tools import varexplorer as ve
from bluesky.tools.simtime import timed_function

# Register settings defaults
settings.set_variable_defaults(plugin_path='plugins', enabled_plugins=['datafeed'])

# Dict of descriptions of plugins found for this instance of bluesky
plugin_descriptions = dict()
# Dict of loaded plugins for this instance of bluesky
active_plugins = dict()

class Plugin:
    def __init__(self, fname):
        fname = path.normpath(path.splitext(fname)[0].replace('\\', '/'))
        self.module_path, self.module_name = path.split(fname)
        self.module_imp = fname.replace('/', '.')
        self.plugin_doc   = ''
        self.plugin_name  = ''
        self.plugin_type  = ''
        self.plugin_stack = []
github TUDelft-CNS-ATM / bluesky / bluesky / sim / qtgl / mainmanager.py View on Github external
try:
    from PyQt5.QtCore import QObject, QEvent, QTimer, pyqtSignal, \
        QCoreApplication as qapp
except ImportError:
    from PyQt4.QtCore import QObject, QEvent, QTimer, pyqtSignal, \
        QCoreApplication as qapp

# Local imports
from bluesky import settings
from .simevents import SimStateEventType, SimQuitEventType, BatchEventType, \
    BatchEvent, StackTextEvent, StackTextEventType, SimQuitEvent, SetNodeIdType, \
    SetActiveNodeType, AddNodeType

Listener.fileno = lambda self: self._listener._socket.fileno()
# Register settings defaults
settings.set_variable_defaults(max_nnodes=cpu_count())

def split_scenarios(scentime, scencmd):
    start = 0
    for i in range(1, len(scencmd) + 1):
        if i == len(scencmd) or scencmd[i][:4] == 'SCEN':
            scenname = scencmd[start].split()[1].strip()
            yield (scenname, scentime[start:i], scencmd[start:i])
            start = i


class MainManager(QObject):
    instance           = None
    # Signals
    nodes_changed      = pyqtSignal(str, tuple, int)
    activenode_changed = pyqtSignal(tuple, int)
github TUDelft-CNS-ATM / bluesky / bluesky / network / server.py View on Github external
import os
from multiprocessing import cpu_count
from threading import Thread
import sys
from subprocess import Popen
import zmq
import msgpack

# Local imports
import bluesky as bs

from .discovery import Discovery


# Register settings defaults
bs.settings.set_variable_defaults(max_nnodes=cpu_count(),
                                  event_port=9000, stream_port=9001,
                                  simevent_port=10000, simstream_port=10001,
                                  enable_discovery=False)

def split_scenarios(scentime, scencmd):
    ''' Split the contents of a batch file into individual scenarios. '''
    start = 0
    for i in range(1, len(scencmd) + 1):
        if i == len(scencmd) or scencmd[i][:4] == 'SCEN':
            scenname = scencmd[start].split()[1].strip()
            yield dict(name=scenname, scentime=scentime[start:i], scencmd=scencmd[start:i])
            start = i


class Server(Thread):
    ''' Implementation of the BlueSky simulation server. '''
github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / openap / coeff.py View on Github external
''' OpenAP performance library. '''
import os
import json
import numpy as np
import pandas as pd
from bluesky import settings
settings.set_variable_defaults(perf_path_openap="data/performance/OpenAP")

LIFT_FIXWING = 1     # fixwing aircraft
LIFT_ROTOR = 2       # rotor aircraft

ENG_TYPE_TF = 1         # turbofan, fixwing
ENG_TYPE_TP = 2         # turboprop, fixwing
ENG_TYPE_TS = 3         # turboshlft, rotor

synonyms_db = settings.perf_path_openap + "/synonym.dat"

fixwing_aircraft_db = settings.perf_path_openap + "/fixwing/aircraft.json"
fixwing_engine_db = settings.perf_path_openap + "/fixwing/engines.csv"
fixwing_envelops_dir = settings.perf_path_openap + "/fixwing/wrap/"
fixwing_dragpolar_db = settings.perf_path_openap + "/fixwing/dragpolar.csv"

rotor_aircraft_db = settings.perf_path_openap + "/rotor/aircraft.json"
github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / legacy / coeff_bs.py View on Github external
""" BlueSky aircraft performance calculations."""
import os

from xml.etree import ElementTree
from math import *
import numpy as np
import bluesky as bs
from bluesky.tools.aero import ft, g0, a0, T0, rho0, gamma1, gamma2,  beta, R, \
    kts, lbs, inch, sqft, fpm, vtas2cas

from .performance import esf, phases, calclimits, PHASE
from bluesky import settings

# Register settings defaults
settings.set_variable_defaults(perf_path='data/performance', verbose=False)

class CoeffBS:
    """
    Coefficient class definition : get aircraft-specific coefficients from database
    Created by  : Isabel Metz

    References:

    - D.P. Raymer. Aircraft Design: A Conceptual Approach. AIAA Education Series.
    American Institute of Aeronautics and Astronautics, Inc., Reston, U.S, fifth edition, 2012.
    - R. Babikian. The Historical Fuel Efficiency Characteristics of Regional Aircraft from
    Technological, Operational, and Cost Perspectives. Master's Thesis, Massachusetts
    Institute of Technology, Boston, U.S.
    """

    def __init__(self):
github TUDelft-CNS-ATM / bluesky / bluesky / tools / __init__.py View on Github external
from bluesky import settings
# Register settings defaults
settings.set_variable_defaults(prefer_compiled=False)
from .timer import Timer
from .trafficarrays import RegisterElementParameters, TrafficArrays
from .signal import Signal
if settings.prefer_compiled:
    try:
        from . import cgeo as geo
        print('Using compiled geo functions')
    except ImportError:
        from . import geo
        print('Using Python-based geo functions')
else:
    from . import geo
    print('Using Python-based geo functions')

from .trafficarrays import RegisterElementParameters, TrafficArrays
from . import cachefile
github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / legacy / perfbs.py View on Github external
""" BlueSky aircraft performance calculations."""
import os

from math import *
import numpy as np
import bluesky as bs
from bluesky.tools.aero import ft, g0, a0, T0, rho0, gamma1, gamma2,  beta, R, \
    kts, lbs, inch, sqft, fpm, vtas2cas
from bluesky.tools.trafficarrays import TrafficArrays, RegisterElementParameters
from bluesky.traffic.performance.legacy.performance import esf, phases, calclimits, PHASE
from bluesky import settings

from bluesky.traffic.performance.legacy.coeff_bs import CoeffBS

# Register settings defaults
settings.set_variable_defaults(perf_path='data/performance/BS', verbose=False)
coeffBS = CoeffBS()


class PerfBS(TrafficArrays):
    def __init__(self):
        super(PerfBS,self).__init__()
        self.warned  = False    # Flag: Did we warn for default perf parameters yet?
        self.warned2 = False    # Flag: Use of piston engine aircraft?

        # prepare for coefficient readin
        coeffBS.coeff()

        # Flight performance scheduling
        self.dt  = 0.1           # [s] update interval of performance limits
        self.t0  = -self.dt  # [s] last time checked (in terms of simt)
github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / legacy / perfbs.py View on Github external
import os

from xml.etree import ElementTree
from math import *
import numpy as np
import bluesky as bs
from bluesky.tools.aero import ft, g0, a0, T0, rho0, gamma1, gamma2,  beta, R, \
    kts, lbs, inch, sqft, fpm, vtas2cas
from bluesky.tools.trafficarrays import TrafficArrays, RegisterElementParameters
from .performance import esf, phases, calclimits, PHASE
from bluesky import settings

from . import coeff_bs

# Register settings defaults
settings.set_variable_defaults(perf_path='data/coefficients', verbose=False)
coeffBS = coeff_bs.CoeffBS()


class PerfBS(TrafficArrays):
    def __init__(self):
        super(PerfBS,self).__init__()
        self.warned  = False    # Flag: Did we warn for default perf parameters yet?
        self.warned2 = False    # Flag: Use of piston engine aircraft?

        # prepare for coefficient readin
        coeffBS.coeff()

        # Flight performance scheduling
        self.dt  = 0.1           # [s] update interval of performance limits
        self.t0  = -self.dt  # [s] last time checked (in terms of simt)
github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / legacy / perfbs.py View on Github external
import os

from math import *
import numpy as np
import bluesky as bs
from bluesky.tools.simtime import timed_function
from bluesky.tools.aero import ft, g0, a0, T0, rho0, gamma1, gamma2,  beta, R, \
    kts, lbs, inch, sqft, fpm, vtas2cas
from bluesky.tools.trafficarrays import TrafficArrays, RegisterElementParameters
from bluesky.traffic.performance.legacy.performance import esf, phases, calclimits, PHASE
from bluesky import settings

from bluesky.traffic.performance.legacy.coeff_bs import CoeffBS

# Register settings defaults
settings.set_variable_defaults(perf_path='data/performance/BS', 
                               performance_dt=1.0, verbose=False)
coeffBS = CoeffBS()


class PerfBS(TrafficArrays):
    def __init__(self):
        super(PerfBS,self).__init__()
        self.warned  = False    # Flag: Did we warn for default perf parameters yet?
        self.warned2 = False    # Flag: Use of piston engine aircraft?

        # prepare for coefficient readin
        coeffBS.coeff()

        with RegisterElementParameters(self):
            # index of aircraft types in library
            self.coeffidxlist = np.array([])