NNDy/scripts/DA/newRun_NNDy.py

48 lines
1.2 KiB
Python

import os, shutil, re, warnings, time
import threading
import socketserver
import zmq
import lyse
def send_message(message):
url = "tcp://" + str("127.0.0.1") + ":" + str(24325)
context = zmq.Context()
with context.socket(zmq.REQ) as client:
client.connect(url)
client.send_json(message)
msg = client.recv_json()
print("Send signal to NNDy.")
def send_to_ploting(hdf5files_path):
if not isinstance(hdf5files_path, str):
hdf5files_path = hdf5files_path.decode('utf-8')
fileName = hdf5files_path.split("\\")[-1]
sequenceName = '_'.join(fileName.split("_")[2:-1])
year = fileName.split("_")[0].split("-")[0]
month = fileName.split("_")[0].split("-")[1]
day = fileName.split("_")[0].split("-")[2]
shotName = fileName.split("_")[1]
runNum = fileName.split("_")[-1].split(".")[0]
runID = str(year + month + day + shotName + runNum)
msg = sequenceName + ',' + runID
send_message(msg)
if __name__ == '__main__':
df = lyse.data()
hdf5files_path = str(df.filepath.iloc[-1])
send_to_ploting(hdf5files_path)