def checkFolder(): import PostProcessor, logger #monitor a selected folder for 'snatched' files that haven't been processed logger.info('Checking folder ' + mylar.CHECK_FOLDER + ' for newly snatched downloads') PostProcess = PostProcessor.PostProcessor('Manual Run', mylar.CHECK_FOLDER) result = PostProcess.Process() logger.info('Finished checking for newly snatched downloads')
def resumePostProcessors(): """ Pickup left off Post Processors that were cancelled via CTRL-C """ # FIXME: with the new queue, could kill the processing dir sym links (for windows) from Hellanzb.NZBLeecher.NZBModel import NZB for archiveDirName in os.listdir(Hellanzb.PROCESSING_DIR): if archiveDirName[0] == '.': continue archive = NZB.fromStateXML('processing', archiveDirName) troll = PostProcessor.PostProcessor(archive) info('Resuming post processor: ' + archiveName(archiveDirName)) troll.start()
def handleNZBDone(nzb): """ Hand-off from the downloader -- make a dir for the NZB with its contents, then post process it in a separate thread""" disconnectUnAntiIdleFactories() if nzb.downloadStartTime: downloadAndDecodeTime = time.time() - nzb.downloadStartTime if not nzb.isParRecovery: nzb.downloadAndDecodeTime = downloadAndDecodeTime else: nzb.downloadAndDecodeTime += downloadAndDecodeTime # Make our new directory, minus the .nzb processingDir = os.path.join(Hellanzb.PROCESSING_DIR, nzb.archiveName) # Move our nzb contents to their new location for post processing hellaRename(processingDir) move(Hellanzb.WORKING_DIR, processingDir) nzb.destDir = processingDir nzb.archiveDir = processingDir nzbFileName = os.path.join(processingDir, os.path.basename(nzb.nzbFileName)) # We may have downloaded an NZB file of the same name: # http://hellanzb.com/trac/hellanzb/ticket/425 hellaRename(nzbFileName) move(nzb.nzbFileName, nzbFileName) nzb.nzbFileName = nzbFileName os.mkdir(Hellanzb.WORKING_DIR) # The list of skipped pars is maintained in the state XML as only the subjects of the # nzbFiles. PostProcessor only knows to look at the NZB.skippedParSubjects list, # created here nzb.skippedParSubjects = nzb.getSkippedParSubjects() # Finally unarchive/process the directory in another thread, and continue # nzbing troll = PostProcessor.PostProcessor(nzb) # Give NZBLeecher some time (another reactor loop) to killHistory() & scrollEnd() # without any logging interference from PostProcessor reactor.callLater(0, troll.start) reactor.callLater(0, writeStateXML) reactor.callLater(0, scanQueueDir)
def processPage(page): page = PageProcessor.normalize(page) if (not context["mute"]): print("Extracting errors") page = ErrorExtractor.extract(page) if (len(page["revisions"]) == 0 or len(page["errors"]) == 0): context["processedPages"] += 1 print("No errors extracted") return if (not context["mute"]): print("Post processing errors") page = PostProcessor.process(page) if (not context["mute"]): print("Flushing to corpora") Exporter.exportToStream(page) context["processedPages"] += 1 delta = datetime.datetime.now() - context["startTime"] remainingTime = context["pagesCount"] / float( context["processedPages"]) * delta print("Estimated remaining time: %s" % str(remainingTime))
if __name__ == '__main__': MC_interface = GNATS_MonteCarlo_Interface(); curr_ac = "SWA1897"; '''Flight Plan Latitude''' fpwpidx = 6; mean_lat = 40.995819091796875; std_dev_lat = 0.01*mean_lat; sample_sz_lat = 5; k=0; lat_vec = np.random.normal(mean_lat,std_dev_lat,sample_sz_lat) '''args = [ac_name, var_name, var_vals, fpindex (optional)]''' args = [[curr_ac],args_dict[6],lat_vec,fpwpidx] MC_interface.runMCSims(args) post_process = pp.PostProcessor(file_path = "../GNATS_Server", \ ac_name = curr_ac); post_process.plotRoutine();
aircraftInterface.release_aircraft() environmentInterface.release_rap() # Close connection from NATS Server natsClient.disConnect() # ========================================================= # The following statements read the result trajectory files and display plotting. # Notice!!!! # The following statements assume that NATS_Client and NATS_Server are installed on the same machine. # If NATS_Server is installed on another machine, the following Python codes will not work due to inability to access the server files. # Create temp directory on NATS_Server side and copy the result trajectory file into it planned_dirname = "tmp_" + planned_dirname os.makedirs("../NATS_Server/" + planned_dirname) copyfile("../NATS_Server/" + output_filename_before, "../NATS_Server/" + planned_dirname + "/" + output_filename_before) copyfile("../NATS_Server/" + output_filename_after, "../NATS_Server/" + planned_dirname + "/" + output_filename_after) post_process = pp.PostProcessor(file_path="../NATS_Server/" + planned_dirname, ac_name='SWA1897') post_process.plotSingleAircraftTrajectory() # Delete temp directory print "Deleting directory:", planned_dirname rmtree("../NATS_Server/" + planned_dirname) shutdownJVM()
else: self.runMCSimsWithPause(args) else: print('Wrong number of arguments please refer to the usage.') if __name__ == '__main__': MC_interface = NATS_MonteCarlo_Interface() curr_ac = "AC0001" '''Flight Plan Latitude''' fpwpidx = 6 mean_lat = 40.995819091796875 std_dev_lat = 0.01 * mean_lat sample_sz_lat = 5 k = 0 rv = centaur.Distribution() rv.new_Normal(mean_lat, std_dev_lat) lat_vec = rv.sample(sample_sz_lat) '''args = [ac_name, var_name, var_vals, fpindex (optional)]''' args = [[curr_ac], args_dict[6], lat_vec, fpwpidx] MC_interface.runMCSims(args) post_process = pp.PostProcessor(file_path = "/home/dyn.datasys.swri.edu/mhartnett/NASA_ULI/NASA_ULI_InfoFusion/src/NATS/Server/", \ ac_name = curr_ac) post_process.plotRoutine()
modifiedFlag = ShimReflection.shim(dedicatedDir, 'com/apptroller', lines, i, googleAccount) modified = modified or modifiedFlag # Check if theres a function in use that we don't handle, # but should. In that case, we'll print to stdout and # continue, but the resulting APK might not work... for function in incompleteFunctions: if sline.find(function) != -1: e('Found function that we\'re not handling!: %s (in %s)' % (function, smaliPath), False) i = i + 1 if modified: pp = PostProcessor() pp.process(lines) d(' Modified: %s' % smaliPath) hSmali = open(smaliPath, 'w') hSmali.write(''.join(lines)) hSmali.close() processedFiles.append(smaliPath) #if reflectionFound: # makeAllMethodsPublic(filesWithUnhandledMethods) v('Removing permissions from manifest file... ',) newManifestXML = '' hManifest = open(tempDir + '/AndroidManifest.xml', 'r')
def post_process_CDNR(dirPath): ac_list = ["SWA1897", "SWA6516"] AllTrajs = {} for ac in ac_list: AllTrajs[ac] = [] for ac in ac_list: # post_process = pp.PostProcessor(file_path = "../NATS_Server", \ # ac_name = ac); post_process = pp.PostProcessor(file_path = dirPath, \ ac_name = ac) # post_process.plotRoutine(); # post_process.plotSingleAircraftTrajectory(); AllTrajs[ac].extend(post_process.LatLonAltSamp) nfiles = len(AllTrajs[ac_list[0]]) fig, axs = plt.subplots(nrows=2, ncols=1) lv = [] AllLon = [] AllLat = [] AllT = [] for file in range(nfiles): traj1 = copy.deepcopy(AllTrajs[ac_list[0]][file]) traj2 = copy.deepcopy(AllTrajs[ac_list[1]][file]) if len(traj1) > len(traj2): ntime = len(traj2) T = [] RD = [] Lat = [] Lon = [] for k in range(ntime): val1 = [a for a in traj2[k]] idx = -1 for j in range(len(traj1)): if abs(traj1[j][0] - val1[0]) < 1e-3: idx = j break if idx >= 0: val2 = [a for a in traj1[idx]] T.append(val2[0]) reldist = compute_distance_gc(val1[1], val1[2], val2[1], val2[2], (val1[3] + val2[3]) / 2.) RD.append(reldist) Lat.append([val1[1], val2[1]]) Lon.append([val1[2], val2[2]]) line, = axs[0].plot(T, RD, '-x') lv.append(line) Lat = np.array(Lat) Lon = np.array(Lon) axs[1].plot(Lon[:, 1], Lat[:, 1], '--r') axs[1].plot(Lon[:, 0], Lat[:, 0], '--b') AllLat.append(Lat) AllLon.append(Lon) AllT.append(T) else: ntime = len(traj1) T = [] RD = [] Lat = [] Lon = [] for k in range(ntime): val1 = [a for a in traj1[k]] idx = -1 for j in range(len(traj2)): if abs(traj2[j][0] - val1[0]) < 1e-3: idx = j break if idx >= 0: val2 = [a for a in traj2[idx]] T.append(val2[0]) reldist = compute_distance_gc(val1[1], val1[2], val2[1], val2[2], (val1[3] + val2[3]) / 2.) RD.append(reldist) Lat.append([val1[1], val2[1]]) Lon.append([val1[2], val2[2]]) line, = axs.plot(T, RD, '-x') lv.append(line) Lat = np.array(Lat) Lon = np.array(Lon) axs[1].plot(Lon[:, 1], Lat[:, 1], '--r') axs[1].plot(Lon[:, 0], Lat[:, 0], '--b') AllLat.append(Lat) AllLon.append(Lon) AllT.append(T) axs[0].set_xlabel('Time(s)') axs[0].set_ylabel('Relative distance between two aircraft (ft)') axs[0].grid(True) axs[0].set_xlabel('Longitude (deg)') axs[0].set_ylabel('Latitude (deg)') axs[0].grid(True) lh = axs[0].axhline(5 * 6076, ls='--') # fig.legend( (lv[0],lv[1],lh), ('w CDNR', 'w/o CDNR','resolution threshold'), # 'upper center', ncol = 3) # plt.show() try: assert len(AllLat) == len(AllLon) == len(AllT) == 2 except AssertionError: print('Please remove the *.csv files in the server folder') raise frame_num = len(AllT[0]) minlon = min(np.min(AllLon[0]), np.min(AllLon[1])) maxlon = max(np.max(AllLon[0]), np.max(AllLon[1])) minlat = min(np.min(AllLat[0]), np.min(AllLat[1])) maxlat = max(np.max(AllLat[0]), np.max(AllLat[1])) fig = plt.figure() ax = plt.axes(xlim=(minlon, maxlon), ylim=(minlat, maxlat)) line11, = ax.plot([], [], linestyle='--', color='r', marker='x', linewidth=2) line12, = ax.plot([], [], linestyle='--', color='g', marker='o', linewidth=2) line21, = ax.plot([], [], linestyle='--', color='k', marker='d', linewidth=2) line22, = ax.plot([], [], linestyle='--', color='b', marker='+', linewidth=2) lines = [line11, line12, line21, line22] def init(): for line in lines: line.set_data([], []) return lines def animate(i): xlist = [ AllLon[0][:i, 0], AllLon[0][:i, 1], AllLon[1][:i, 0], AllLon[1][:i, 1] ] ylist = [ AllLat[0][:i, 0], AllLat[0][:i, 1], AllLat[1][:i, 0], AllLat[1][:i, 1] ] for lnum, line in enumerate(lines): line.set_data(xlist[lnum], ylist[lnum]) # set data for each line separately. return lines # call the animator. blit=True means only re-draw the parts that have changed. anim = animation.FuncAnimation(fig, animate, init_func=init, frames=frame_num, interval=10, blit=True) plt.show()
# The trajectory output file will be saved on NATS_Server side simulationInterface.write_trajectories(output_filename) aircraftInterface.release_aircraft() environmentInterface.release_rap() # Close connection from NATS Server natsClient.disConnect() # ========================================================= # The following statements read the result trajectory files and display plotting. # Notice!!!! # The following statements assume that NATS_Client and NATS_Server are installed on the same machine. # If NATS_Server is installed on another machine, the following Python codes will not work due to inability to access the server files. # Create temp directory on NATS_Server side and copy the result trajectory file into it planned_dirname = "tmp_" + planned_dirname os.makedirs("../NATS_Server/" + planned_dirname) copyfile("../NATS_Server/" + output_filename, "../NATS_Server/" + planned_dirname + "/" + output_filename) post_process = pp.PostProcessor(file_path = "../NATS_Server/" + planned_dirname, ac_name = 'ULI-3E6A0495F1'); post_process.plotSingleAircraftTrajectory(); # Delete temp directory print "Deleting directory:", planned_dirname rmtree("../NATS_Server/" + planned_dirname) shutdownJVM()
def LongPoll(): for event in longpoll.listen(): if event.type == VkEventType.MESSAGE_NEW: Fixer.bChats = 0 if event.from_user: if event.user_id != Author: SendAuthor('~Уведомление: пользователь VK %i пишет: %s' % (event.user_id, event.text)) elif event.from_chat: Fixer.bChats = 1 # признак чата if event.text.upper()[:3] == 'DI,' or event.text.upper( )[:3] == 'ДИ,': Fixer.bChats = 2 # надо ответить if event.user_id != Author: SendAuthor( '~Уведомление: пользователь VK %i пишет в беседе %i: %s' % (event.user_id, event.chat_id, event.text)) elif event.from_group: Fixer.bChats = 1 # признак чата if event.user_id != Author: SendAuthor( '~Уведомление: пользователь VK %i пишет в группе %i: %s' % (event.user_id, event.group_id, event.text)) if Fixer.bChats == 1: continue # пропускаем беседу # Обработка сообщений для бота if event.to_me: text = event.text try: if len(text) > 3: if text.upper()[:3] == 'DI,' or text.upper( )[:3] == 'ДИ,': text = text[3:].strip() Fixer.ChatID = event.chat_id Fixer.PeerID = event.peer_id # Идентификатор юзера Fixer.UserID = event.user_id Msg = GetMessange(Fixer.UserID)['items'][0] print(Msg) # печать сообщения Fixer.Time.append(Fixer.time()) Fixer.Chat.append(text) if Chat.Load() == False: # Получение информации о пользователе getInfo() print('Данные не найдены') Fixer.Mess = Home # Бот начинает писать текст vk.method( 'messages.setActivity', { 'user_id': Fixer.UserID, 'chat_id': Fixer.ChatID, 'type': 'typing' }) # Поиск текущей локации пользователя if 'geo' in Msg: Fixer.Process = 'Bot.GetUserLocation' geo = Msg['geo'] s = '' if 'coordinates' in geo: s = location(geo['coordinates']) + '\n' if 'place' in geo: if 'country' in geo['place']: s += geo['place']['country'] + ', ' if 'city' in geo['place']: s += geo['place']['city'] if text == '': SendMessage(s) Chat.Save() continue # Поиск стикеров и вложений if 'attachments' in Msg: iphoto = 0 Fixer.Process = 'Bot.GetUserAttachments' for att in Msg[ 'attachments']: # иттератор по вложениям if att['type'] == 'sticker': # найден стикер SendMessage( 'Сорян. Я не умею распознавать стикеры.') continue elif att['type'] == 'photo': # найдено фото iphoto += 1 else: # другой тип вложения if text == '': SendMessage( 'В данных типах вложениях я не разбираюсь :(' ) continue if iphoto > 0: if iphoto == 1: s = 'Одно фото во вложении. В будующем смогу провести анализ фото :)' elif iphoto > 1: s = 'Найдено ' + str( iphoto) + ' изображений/фото во вложении.' SendMessage(s) continue # пропускаем сообщение # ------------ основная обработка пользовательских сообщений --------------- else: # Мультипроцессорный обработчик - когда в одном сообщении сразу несколько запросов mProcess = PreProcessor.MultiProcessor(text) print(mProcess) for itext in mProcess: # Препроцессорный обработчик Fixer.Process = 'Bot.PreProcessor' request = PreProcessor.ReadMessage(itext) # Процессорный обработчик Fixer.Process = 'Bot.Processor' request = Processor.FormMessage(request) Fixer.log('Processor', request) if request[ 0] == '#': # Требуется постпроцессорная обработка request = PostProcessor.ErrorProcessor(request) if request[: 6] == '#LOC! ': # Требуется определить геолокацию # !Доработать блок! request = location( str(Fixer.Y) + ' ' + str(Fixer.X)) request += '\nДля определения более точных координаты в VK, прикрепи и отправь мне текущее местоположение на карте.' Fixer.log('PostProcessor', request) SendMessage(request) else: # Постпроцессорная обработка не требуется if Fixer.Service != '': Fixer.LastService.append(Fixer.Service) SendMessage(request) if Fixer.htext != '': # если есть гипперссылка/ки Fixer.log('HiperText', Fixer.htext) slink = 'Ссылка: ' # если одна ссылка if '\n' in Fixer.htext: slink = 'Ссылки:' Fixer.htext = slink + Fixer.htext else: Fixer.htext = slink + Fixer.htext.replace( ' ', '%20') SendMessage(Fixer.htext) Fixer.htext = '' Chat.Save() Notification.Process() # запуск системы уведомлений except Exception as e: s = str(e) Fixer.errlog(Fixer.Process, str(e)) SendMessage(PostProcessor.ErrorProcessor('#critical: ' + s))
% context["outputFormat"]) context["outputFormat"] = "txt" #Create output file and output path if it doesn't exists if not os.path.exists(context["outputFolder"]): os.makedirs(context["outputFolder"]) context["outputStreamFull"] = io.open( '%soutput.%s' % (context["outputFolder"], context["outputFormat"]), 'w+', encoding="utf-8") context["outputStreamOrphans"] = io.open( '%soutput-orphans.%s' % (context["outputFolder"], context["outputFormat"]), 'w+', encoding="utf-8") from importlib import import_module context["errCorpConfig"] = import_module("confs." + context["lang"][0] + "-err-corp") context["unitokConfig"] = import_module("confs." + context["lang"][0]) Exporter.context = context PageProcessor.context = context ErrorExtractor.context = context PostProcessor.__init__(context) Utils.context = context if (len(context["pageDownloads"]) > 0): WikiDownload.init(context["lang"][1]) print("Environment prepared") main()
else: if isinstance(checker_arg[0], basestring): self.runMCSims(args) else: self.runMCSimsWithPause(args) else: print('Wrong number of arguments please refer to the usage.') if __name__ == '__main__': MC_interface = NATS_MonteCarlo_Interface() curr_ac = "AC0001" '''Flight Plan Latitude''' fpwpidx = 6 mean_lat = 40.995819091796875 std_dev_lat = 0.01 * mean_lat sample_sz_lat = 5 k = 0 lat_vec = np.random.normal(mean_lat, std_dev_lat, sample_sz_lat) '''args = [ac_name, var_name, var_vals, fpindex (optional)]''' args = [[curr_ac], args_dict[6], lat_vec, fpwpidx] MC_interface.runMCSims(args) post_process = pp.PostProcessor(file_path = "../Server/", \ ac_name = curr_ac) post_process.plotRoutine()
if __name__ == '__main__': MC_interface = GNATS_MonteCarlo_Interface(); curr_ac = "SQ12"; '''Flight Plan Latitude''' fpwpidx = 6; mean_lat = 40.995819091796875; std_dev_lat = 0.01*mean_lat; sample_sz_lat = 5; k=0; lat_vec = np.random.normal(mean_lat,std_dev_lat,sample_sz_lat) '''args = [ac_name, var_name, var_vals, fpindex (optional)]''' args = [[curr_ac],args_dict[6],lat_vec,fpwpidx] MC_interface.runMCSims(args) post_process = pp.PostProcessor(file_path = ".", \ ac_name = curr_ac); post_process.plotRoutine();
time.sleep(1) # Close connection from NATS Server natsClient.disConnect() # ========================================================= # The following statements read the result trajectory files and display plotting. # Notice!!!! # The following statements assume that NATS_Client and NATS_Server are installed on the same machine. # If NATS_Server is installed on another machine, the following Python codes will not work due to inability to access the server files. # Create temp directory on NATS_Server side and copy the result trajectory file into it planned_dirname = "tmp_" + planned_dirname os.makedirs(planned_dirname) local_trajectory_filename = output_filename copyfile(local_trajectory_filename, planned_dirname + "/" + local_trajectory_filename) post_process = pp.PostProcessor(file_path=planned_dirname, ac_name='SWA1897') post_process.plotSingleAircraftTrajectory() # Delete temp directory print "Deleting directory:", planned_dirname rmtree(planned_dirname) shutdownJVM()
# ========================================================= # The following statements read the result trajectory files and display plotting. # Notice!!!! # The following statements assume that NATS_Client and NATS_Server are installed on the same machine. # If NATS_Server is installed on another machine, the following Python codes will not work due to inability to access the server files. # Create temp directory on NATS_Server side and copy the result trajectory file into it planned_dirname = "tmp_" + planned_dirname os.makedirs(NATS_SERVER_DIR + "/" + planned_dirname) copyfile( NATS_SERVER_DIR + "/" + output_filename_before, NATS_SERVER_DIR + "/" + planned_dirname + "/" + output_filename_before) copyfile( NATS_SERVER_DIR + "/" + output_filename_after, NATS_SERVER_DIR + "/" + planned_dirname + "/" + output_filename_after) post_process = pp.PostProcessor(file_path=NATS_SERVER_DIR + "/" + planned_dirname, ac_name='SWA1897') post_process.plotSingleAircraftTrajectory() # Delete temp directory print "Deleting directory:", planned_dirname rmtree(NATS_SERVER_DIR + "/" + planned_dirname) # Close connection from NATS Server natsClient.disConnect() shutdownJVM()
std_dev_3 = 0.01*np.abs(mean_3); mean = [mean_1,mean_2,mean_3]; cov = [[std_dev_1**2,0,0],[0,std_dev_2**2,0],[0,0,std_dev_3**2]]; sample_sz = 5; vec_1,vec_2,vec_3 = np.random.multivariate_normal(mean, cov, sample_sz).T var_vec = [] for i in range(sample_sz): var_vec.append([vec_1[i],vec_2[i],vec_3[i]]) args = [ac_list,time_pause,var_name,var_vec,fpwidx]; ''' RUN MONTE CARLO''' '''This is deprecated. However, will still run. We have upgraded it with the function below.''' #MC_interface.runMCSims(args) '''Handles all kinds of MC Simulations. If you want to perturb IC you can do it. If you want to perturb states and controls at runtime you can also do that. You need to specify times when you want to do that.''' MC_interface.MCManager(args) '''Post Processing and plotting the MC examples.''' for ac in ac_list: post_process = pp.PostProcessor(file_path = "../NATS_Server_20180909_1532", \ ac_name = ac); # post_process.plotRoutine(); post_process.plotSingleAircraftTrajectory(); # post_process.plotVariable('departure_delay')
# mean_course_deg = 200; # vec_2_1 = np.random.uniform(meanPercentage*0.9, meanPercentage*1.1,sample_sz); # vec_2_2 = np.random.uniform(mean_course_deg*0.9, mean_course_deg*1.1,sample_sz) # meanTimeStep = 6; # vec_3 = np.random.exponential(meanTimeStep,sample_sz) # var_vec = []; # for i in range(sample_sz): # var_vec.append([ [vec_1_1[i],vec_1_2[i]], [vec_2_1[i],vec_2_2[i]], vec_3[i] ]); # args = [ac_list,time_pause,var_name,var_vec,fpwidx]; ''' RUN MONTE CARLO''' '''This is deprecated. However, will still run. We have upgraded it with the function below.''' #MC_interface.runMCSims(args) '''Handles all kinds of MC Simulations. If you want to perturb IC you can do it. If you want to perturb states and controls at runtime you can also do that. You need to specify times when you want to do that.''' MC_interface.MCManager(args) '''Post Processing and plotting the MC examples.''' for ac in ac_list: post_process = pp.PostProcessor(file_path = ".", \ ac_name = ac, auto_detect_server_folder_flag = False) # post_process.plotRoutine(); # post_process.plotSingleAircraftTrajectory(); # # post_process.plotVariable('departure_delay') post_process.plotFinalHistograms(['latitude', \ 'longitude', \ 'altitude'])
def nzbComplete(self, queue_item): PostProcessor.process_nzb(queue_item)
else: if isinstance(checker_arg[0], basestring): self.runMCSims(args) else: self.runMCSimsWithPause(args) else: print 'Wrong number of arguments please refer to the usage.' if __name__ == '__main__': MC_interface = NATS_MonteCarlo_Interface() curr_ac = "SWA1897" '''Flight Plan Latitude''' fpwpidx = 6 mean_lat = 40.995819091796875 std_dev_lat = 0.01 * mean_lat sample_sz_lat = 5 k = 0 lat_vec = np.random.normal(mean_lat, std_dev_lat, sample_sz_lat) '''args = [ac_name, var_name, var_vals, fpindex (optional)]''' args = [[curr_ac], args_dict[6], lat_vec, fpwpidx] MC_interface.runMCSims(args) post_process = pp.PostProcessor(file_path = "../NATS_Server_20180903_2037", \ ac_name = curr_ac) post_process.plotRoutine()
# The trajectory output file will be saved on NATS_Server side simulationInterface.write_trajectories(output_filename) aircraftInterface.release_aircraft() environmentInterface.release_rap() # Close connection from NATS Server natsClient.disConnect() # ========================================================= # The following statements read the result trajectory files and display plotting. # Notice!!!! # The following statements assume that NATS_Client and NATS_Server are installed on the same machine. # If NATS_Server is installed on another machine, the following Python codes will not work due to inability to access the server files. # Create temp directory on NATS_Server side and copy the result trajectory file into it planned_dirname = "tmp_" + planned_dirname os.makedirs("../NATS_Server/" + planned_dirname) copyfile("../NATS_Server/" + output_filename, "../NATS_Server/" + planned_dirname + "/" + output_filename) post_process = pp.PostProcessor(file_path="../NATS_Server/" + planned_dirname, ac_name='ULI-3AFSD3DC24') post_process.plotSingleAircraftTrajectory() # Delete temp directory print "Deleting directory:", planned_dirname rmtree("../NATS_Server/" + planned_dirname) shutdownJVM()