Example #1
0
class FakeRecorder():
    Command = Config().getBinPath() + "/fakezap.sh"

    def getArguments(self, epgInfo, durance, filePath):
        tArgs = [self.Command, str(durance)]
        tArgs.append("" + filePath + "")  #No ' if shell=false
        return tArgs
Example #2
0
def run_cloud():
    cfg = Config('config.json')
    cfg.parse()
    gcp = CloudInterface(cfg.project, cfg.zone)
    master = Master(gcp, cfg.network_config, [], cfg.mapper_count,
                    cfg.reducer_count, cfg.map_fn, cfg.reduce_fn,
                    cfg.input_data, cfg.output_data)
    master.run()
Example #3
0
class CZapCommand():
    #TODO needs bin bath for arm
    Command = Config().getBinPath() + "/czapRecord.sh"

    def getArguments(self, epgInfo, durance, filePath):
        #czapRecord.sh durance filePath channel
        channelName = epgInfo.getChannel().getName()
        tArgs = [self.Command, str(durance)]
        tArgs.append("" + filePath + "")
        tArgs.append(channelName)
        return tArgs
 def __init__(self,):
     self._config = Config()
     self._setUpLogging()
     self.epgUpdater = EpgUpdater(self._config)
     OSTools.ensureDirectory(self._config.getRecordingPath(),'')
     self._inhibitor = OSTools.Inhibitor()
     self._recordCmd = DVBDevice.getRecordCommander()
     self._lastJobId="0"
     self._recordPartIndex=0
     self.isActive=True
     self._daemonPolicy = None
Example #5
0
def run_cloud():
    cfg = Config('config.json')
    cfg.parse()
    worker = Worker(
        cfg.network_config,
        cfg.mapper_count,
        cfg.reducer_count,
        cfg.output_data
    )
    print('CFG parsed and worker initialized')
    worker.init()
    worker.run()
Example #6
0
class MediaClientCommand():
    Command = Config().getBinPath() + "/mediaClientRecord.sh"

    def getArguments(self, epgInfo, durance, filePath):
        channel = epgInfo.getChannel()
        tArgs = [
            self.Command,
            str(durance),
            channel.getFrequency(), "Q" + channel.getQam(),
            channel.getSymbolRate(),
            channel.getChannelID()
        ]
        tArgs.append("" + filePath + "")
        return tArgs
    def __init__(self,
                 simulation_name=None,
                 simulation_run=None,
                 microenvironment=None,
                 periods=None):
        """Initialise the simulation.

        Keyword Arguments:
            simulation_name {string} -- The name for this simulation (default: {None})
            simulation_run {string} -- The sequence number for this run of the simulation (default: {None})
        """
        # Create a simpy environment
        self.env = simpy.Environment()
        self.dc = DataCollection(self.env, simulation_name, simulation_run)

        # Set the time interval relative to one hour (minutes = 1/60)
        self.time_interval = 1 / 60
        # Number of periods the simulation will run
        self.periods = periods if periods else 180
        # Name of microenvironment to use
        self.microenvironment_name = microenvironment

        # Routing of people through the model, nodes are decisions, edges are activities
        self.routing = Routing()

        # Import configuration information
        self.config = Config()
        self.config.import_microenvironments()

        self.simulation_params = {
            'simpy_env': self.env,
            'data_collector': self.dc,
            'configuration': self.config,
            'routing': self.routing,
            'time_interval': self.time_interval,
            'simulation_length': self.periods
        }

        # Variables in this scope only
        self.microenvironments = {}
        self.population = {}
Example #8
0
    def __init__(self):
        '''
        starts the app
        '''
        self.configuration = Config()
        self.configuration.setupLogging("webdvb.log")

        self._lastMessage = None
        ml = MessageListener()
        ml.addListener(ml.MSG_STATUS, self.storeLastMessage)
        # ml.addListener(ml.MSG_EPG, this.storeLastMessage)
        ml.addListener(ml.MSG_REFRESH, self.storeLastMessage)

        channelReader = ChannelReader()
        cPath = self.configuration.getChannelFilePath()

        channelReader.readChannels(cPath)
        self.channelList = channelReader.getChannels()
        self.progProvider = EPGProgramProvider(self, self.channelList,
                                               self.configuration)
        self._lastEpgRead = 0.0
        # self._readCachedEpgData()
        self.checkEPGData()
Example #9
0
    def __init__(self):
        '''
        starts the app
        '''
        self.configuration = Config()
        self.configuration.setupLogging("dvb.log")

        channelReader = ChannelReader()
        cPath = self.configuration.getChannelFilePath()

        channelReader.readChannels(cPath)
        self.channelList = channelReader.getChannels()
        self.progProvider = EPGProgramProvider(self, self.channelList,
                                               self.configuration)
        recView = RecorderView(self.progProvider)
        ml = MessageListener()
        ml.addListener(ml.MSG_STATUS, recView.setStatusLine)
        ml.addListener(ml.MSG_EPG, recView.notifyEPGStatus)
        ml.addListener(ml.MSG_REFRESH, recView.refreshProgrammInfos)
        t1 = ReaderThread(False, self._readCachedEpgData)
        t1.start()
        recView.openView()
        #returns on close
        t1.join()
Example #10
0
 def setUpClass(self):
     driver = Config().browser()
     print("Run started at:" + str(datetime.datetime.utcnow()))
     self.ef_driver = EventFiringWebDriver(driver, ScreenshotListener())
     self.ef_driver.maximize_window()
Example #11
0
    # HviConstant:
    #    #1 - Constant name
    #    #2 - Constant value
    #    #3 - Constant units ('s' - seconds, 'Hz' - Herts, 'V' - Volts)
    # HVI:
    #    #1 - HVI file name to load
    #    #2 - List of HviConstants
    #    #3 - Slot number of module to be mapped to
    hvi = Hvi("quadLO.HVI", [
        HviModule("AWG0", [
            HviConstant("NumLoops", repeats, ""),
            HviConstant("PulsePeriod", 150e-06, "s")
        ], 2),
        HviModule("AWG1", [], 4),
        HviModule("DIG0", [], 7)
    ])

    # Config:
    #   #1 - List of Module details
    #   #2 - HVI details
    config = Config(modules, hvi)

    name = __name__
    __name__ = "Configuration"
    saveConfig(config)
    __name__ = name

    config = loadConfig()

    log.info("Config File contents:\n{}".format(vars(config)))
    # audio_features = data['audio'][3]
    shot_num = 4
    data_settings = dict(mode=['place', 'cast', 'action', 'audio'])
    model_settings = dict(
        name='MMSS',
        sim_channel=512,  # dim of similarity vector
        place_feat_dim=2048,
        cast_feat_dim=512,
        act_feat_dim=512,
        aud_feat_dim=512,
        aud=dict(cos_channel=512),
        seq_len=10,  # even
        bidirectional=True,
        lstm_hidden_size=512,
        ratio=[0.5, 0.2, 0.2, 0.1])
    cfg = Config(data_settings, model_settings, shot_num)
    model = MMSS(cfg)
    output = model(place_features, cast_features, action_features,
                   audio_features)
    print(output.data)

    with open('./data/tt0052357.pkl', 'rb') as file:
        data = pickle.load(file)

    place_features = data['place']
    cast_features = data['cast']
    action_features = data['action']
    audio_features = data['audio']
    data_place = train_test_data_splitting(place_features)
    data_cast = train_test_data_splitting(cast_features)
    data_action = train_test_data_splitting(action_features)
Example #13
0
parser.add_argument('--load_config',
                    type=str,
                    help='load the config from obj file')

parser.add_argument('--max_steps',
                    default=1000,
                    type=int,
                    help='max steps per episode')
'''
step_group = parser.add_argument_group('step')
step_group.add_argument('--customize_step', dest='customize_step', action='store_true', help='customize max step per episode')
step_group.add_argument('--max_steps', default=1000, type=int, help='max steps per episode')
'''

args = parser.parse_args()
config = Config()
config.env = args.env
config.gamma = args.gamma
config.episodes = args.episodes
config.max_steps = args.max_steps
config.batch_size = args.batch_size
config.epsilon = args.epsilon
config.eps_decay = args.eps_decay
config.max_buff_size = args.max_buff
config.output = args.output

config.learning_rate_actor = 1e-4
config.learning_rate_critic = 1e-3
config.epsilon_min = 0.001
config.epsilon = 1.0
config.tau = 0.001
Example #14
0
 def getCacheDir(self):
     return os.path.join(Config().getInstance().getXMLCacheDir(),
                         self.cacheName)