def __init__(self, filename_baseline,filename_mean_sd):
     self.structure = Structures.Structures(3, 34, 7, 256)
     self.my_attention_network = self.structure.structure_11_cnn_attention_dot()
     #load weights
     self.my_attention_network.load_weights(filename_baseline)
     self.dictionary =   pickle.load(open(filename_mean_sd, "rb"))
     self.mean_train = self.dictionary.get("mean")
     self.sd_train = self.dictionary.get("sd")
Esempio n. 2
0
 def __init__(self, filename_baseline,filename_mean_sd, Conv=False):
     self.Conv = Conv
     if(self.Conv==False):
         self.structure = Structures.Structures(5, 136, 7, 256)
         self.my_attention_network = self.structure.structure_11_cnn_attention_dot2()
         #load weights
         self.my_attention_network.load_weights(filename_baseline)
         self.dictionary = pd.read_csv("./mean_std.csv").to_dict('list')
         self.mean_train = self.dictionary.get("mean")
         self.sd_train = self.dictionary.get("sd")
     else:
         self.structure = Structures.Structures(119,34,7,60)
         self.my_attention_network = self.structure.structure_convolutions_attention()
         # load weights
         self.my_attention_network.load_weights(filename_baseline)
         self.dictionary = pickle.load(open(filename_mean_sd, "rb"))
         self.mean_train = self.dictionary.get("mean")
         self.sd_train = self.dictionary.get("sd")
Esempio n. 3
0
    def __init__(self, data):
        super().__init__()
        self.data_offset = Structures.BootSectorOffsets()
        self._data = data  # check data ?
        self.bs_jmp_boot = self.get_data(0, 3)  # 0 3
        self.bs_oem_name = self.get_data(3, 8)  # 3 8
        self.bpb_bytes_per_sector = self.get_data(11, 2, True)  # 11 2
        self.bpb_sectors_per_cluster = self.get_data(13, 1, True)  # 13 1
        self.bpb_reserved_region_sectors_count = self.get_data(14, 2,
                                                               True)  # 14 2
        self.bpb_number_fats = self.get_data(16, 1, True)  # 16 1
        self.bpb_root_entry_count = self.get_data(
            17, 2, True)  # 17 2 for fat32 it zero
        self.bpb_total_sectors_16 = self.get_data(
            19, 2, True)  # 19 2 old field in fat 32 must be zero
        self.bpb_media = self.get_data(21, 1)  # 21 1 stand
        self.bpb_fat_size_16 = self.get_data(22, 2, True)  # 22 2
        self.bpb_sectors_per_track = self.get_data(24, 2, True)  # 24 2
        self.bpb_number_heads = self.get_data(
            26, 2, True)  # 26 2 amount of disk heads
        self.bpb_hidden_sectors = self.get_data(28, 4, True)  # 28 4
        self.bpb_total_sectors_32 = self.get_data(
            32, 4, True)  # 32 4 new 32 bit field sm old 16 bit field
        self.bpb_fat_size_32 = self.get_data(
            36, 4, True)  # 36 4 amount of sectors one fat
        self.bpb_ext_flags = self.get_data(40, 2, True)  # 40 2
        self.file_system_version = self.get_data(42, 2)  # 42 2
        self.bpb_root_cluster = self.get_data(44, 4, True)  # 44 4
        self.bpb_file_system_information = self.get_data(48, 2, True)  # 48 2
        self.bpb_backup_boot_sector = self.get_data(50, 2, True)  # 50 2
        self.bpb_reserved = self.get_data(52, 12)  # 52 12
        self.bs_driver_number = self.get_data(64, 1)  # 64 1
        self.bs_reserved1 = self.get_data(65, 1)  # 65 1
        self.bs_boot_signature = self.get_data(66, 1)  # 66 1
        self.bs_volume_id = self.get_data(67, 4)  # 67 4
        self.bs_volume_label = self.get_data(71, 11)  # 71 11
        self.bs_file_system_type = self.get_data(82, 8)  # 82 8

        self._cluster_size = self.bpb_sectors_per_cluster * self.bpb_bytes_per_sector
        self._fat_zone_offset = self.bpb_bytes_per_sector * self.bpb_reserved_region_sectors_count
        self._second_cluster_offset = self.fat_zone_offset
        self._second_cluster_offset += self.bpb_number_fats * self.bpb_fat_size_32 * self.bpb_bytes_per_sector
        self._fat_size = (self.root_directory_offset -
                          self.fat_zone_offset) // self.bpb_number_fats
        self._fat_offsets_list = self._fat_offsets_list()
        self._data_clusters_amount = self._calc_data_clusters()
        self._mirroring = None
        self._active_fat = None
        self._parse_ext_flags()
Esempio n. 4
0
 print("Rosbag opened at "+metaInfo["dir"])
 leftImage=None
 rightImage=None
 visoData=None
 frames=[]
 #####extract messages from rosbag
 #############
 for topic,msg,t in bag.read_messages(topics=['/viso_extractor/output','/bumblebee/left/ROI','/bumblebee/right/ROI']):
     if(topic=="/viso_extractor/output"):
         visoData=msg
     if(topic=="/bumblebee/left/ROI"):
         leftImage=msg
     if(topic=="/bumblebee/right/ROI"):
         rightImage=msg
     if((leftImage!=None)and(rightImage!=None)and(visoData!=None)):
         frameData=Structures.singleFrame(leftImage,rightImage,visoData,len(frames))
         frames.append(frameData)
         leftImage=None
         rightImage=None
         visoData=None
         print("frames extracted "+str(len(frames)))
 bag.close()
 print("Rosbag Closed at "+metaInfo["dir"])
 ####################
 #####Calculate Statistics (skip the first frame always)
 for index in range(1,len(frames)):
     data={"RMS"}
     matches=Structures.getVisoMatches(frames[index].viso)
     epiError=Structures.getEpiPolarError(matches["current"])
     rms=Structures.getRMS(epiError)
     try:
Esempio n. 5
0
                block_subblock[self.subblock_index_dct[value]] = block
        for routeblock, subblock in enumerate(final_state):
            subblock_idx, day_routeblock = np.where(self.all_state==subblock)
            subblock_idx, day_routeblock = subblock_idx[0], day_routeblock[0]
            
            routeblock_day[self.routeblock_index_dct[routeblock]] = day_routeblock
            routeblock_subblock[self.routeblock_index_dct[routeblock]] = self.subblock_index_dct[subblock_idx]
            
        return routeblock_day, routeblock_subblock, block_subblock
            
            
if __name__ == "__main__":
    
    
    df = pd.read_excel(r'data.xlsx', sheet_name='route_block')
    RB = Structures.RouteBlock(df)
    
    #print('Индексы мал. блоков: ', RB.routeblock_index_dct)
    #print('Связь мал. блоков и терминала: ', RB.routeblock_terminal_dct)
    #print('Расстояние мал. блоков: ', RB.routeblock_distance_dct)
    #print('Объемы мал. блоков: ', RB.routeblock_volume_dct)
    #print('Смежность блоков:', RB.routeblock_adjacency_matrix)
    
    data_block = pd.read_excel(r'data.xlsx', sheet_name='subblock')
    SUBBLOCK = Structures.Block_SubBlock(data_block)
    #print('Индексы подблоков: ', SUBBLOCK.subblock_index_dct)
    #print('Связь блоков и подблоков: ', SUBBLOCK.block_subblock_dct)
    #print('Связь подблоков и терминалов: ', SUBBLOCK.subblock_terminal_dct)
    
    data_car_terminal = pd.read_excel(r'data.xlsx', sheet_name='small_cars_terminal')
    Terminal = Structures.Terminal(data_car_terminal)
Esempio n. 6
0
import socket
import sys
from threading import Thread
import pickle

import Structures

mainDueDateOrg = Structures.DueDateOrganizer()

class DuesyInstance(object):
    def __init__(self, port_num):
        self.server = ThreadedServer('localhost',port_num)
        print("Initializing Server...")
        self.server.start()
        

class ThreadedServer(Thread):
    def __init__(self, host, port):
        Thread.__init__(self)
        self.host = host
        self.port = port
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        self.sock.bind((self.host,self.port))
    
    def listenToClient(self, client, add):
        size = 1024
        while True:
            try:
                data = client.recv(size)
                if data:
Esempio n. 7
0
	def __init__(self):
		if len(sys.argv) >= 4:
			if len(sys.argv) == 4:
				self.name = str(sys.argv[3])
			else:
				serverName = ''
				nameList = sys.argv[3:]
				for name in nameList:
					serverName += str(name) + ' '
				serverName = serverName[:-1]
				self.name = serverName
			self.port = int(sys.argv[2])
			if sys.argv[1] != 'localhost':
				self.address = int(sys.argv[1])
			else:
				self.address = 'localhost'
		else:
			print "!! Command poorly formed.  Should look like 'python MUDserver.py localhost 7734 test' or similar. !!"
		self.id_counter = 0
		self.idle_timeout = CONFIG.IDLE_TIMEOUT

		self.log_file = None
		self.chat_log_file_byDate = None

		self.connected_clients = []
		self.cc = self.connected_clients
		self.server_run = True
		self.engine_state = 'running'
		self.player_data = {}
		self.pd = self.player_data

		self.timers = []
		self.move_timers = []
		self.current_time = 0
		self.startup_time = time.time()
		self.delta_time = 0
		self.last_time = 0

		self.god_list = []


		# with open('../data/god_list', 'r') as f:
		# 	self.god_list = f.readlines()

		self.setupLog()
		self.setupClientRecords()

		self.TelnetServer = TelnetServer(
		#address should be a blank string for deployment across a network, as blank allows the server to use any network interface it finds.
		#localhost is for testing where server and clients both exist on one computer, without going across the network
		port=self.port,
		address=self.address,
		on_connect=self.on_connect,
		on_disconnect=self.on_disconnect,
		timeout = .05
		)

		self.Engine = Engine.Engine(self, self.server_run, self.god_list, self.cc, self.pd)
		self.Renderer = Renderer.Renderer(self)
		self.chatManager = ChatManager.chatManager(self)
		self.structureManager = Structures.StructureManager(self)
		self.structureManager.loadAreas()
		self.saveManager = SaveManager.SaveManager(self)
Esempio n. 8
0
# DEPENDENCIES
import secrets
import math
import Wordlists
import Structures

# MACROS
w = Wordlists.Wordlists()
s = Structures.Structures()


# MAIN FUNCTION
def welcome():

    # Print menu
    print("Welcome to the passSentence Generator.")
    print("Please choose your password strength:")
    print("[0] Basic Strength (~44 bits entropy)")
    print("[1] Extra Strength (~77 bits entropy)")
    print("[2] Cryptographic Strenth (~128 bits entropy)")

    # Get input
    char = input(">> ")

    # Process input
    if int(char) == 0:
        genBasicSentence()
    elif int(char) == 1:
        genMediumSentence()
    elif int(char) == 2:
        genCryptoSentence()
        t0.append(0)
    for i in range(len(grid.elements)):
        for j in range(len(grid.elements[i].nodes)):
            t0[grid.elements[i].nodes[j].id -
               1] = grid.elements[i].nodes[j].temp
    new_vector = list(np.array(global_C.gC).dot(np.array(t0)))
    for i in range(global_data.nN):
        new_vector[i] += global_P.gP[i]
    t1_vector = list(
        np.linalg.solve(np.array(global_H.gH), np.array(new_vector)))
    min_temp = min(t1_vector)
    max_temp = max(t1_vector)
    return t1_vector, min_temp, max_temp, new_vector


global_data = S.GlobalData()
init_temp, sim_time, step_time, amb_temp, alfa, Height, Width, N_Height, N_Width, spec_heat, conduct, dens = FR.read(
    'GlobalData.txt')
global_data.assign_values(init_temp, sim_time, step_time, amb_temp, alfa,
                          Height, Width, N_Height, N_Width, spec_heat, conduct,
                          dens)
grid = S.FEMgrid()
grid.create(global_data)
grid.show()

for i in range(len(grid.elements)):
    points_tab = []
    are_edges = []
    for j in range(len(grid.elements[i].nodes)):
        point = [grid.elements[i].nodes[j].x, grid.elements[i].nodes[j].y]
        points_tab.append(point)
Esempio n. 10
0
 def __init__(self):
     self.data_offsets = Structures.BootSectorOffsets()
import Structures as S
import math as m

universal_element = S.UniversalElement()
points_tab = [[0, 0], [0.025, 0], [0.025, 0.025], [0, 0.025]]
conduct = 30
spec_heat = 700
dens = 7800
alfa = 25
are_edges = [1, 0, 0, 0]


class matrixH():
    def __init__(self):
        self.H = []

    def calc_H(self, points_tab, K):
        J_matrices = []
        for i in range(4):
            J_matrices.append(universal_element.calc_jacobian(points_tab, i))
        all_det_J = []
        for i in range(4):
            all_det_J.append(universal_element.calc_det(J_matrices[i]))
        all_J_1 = []
        for i in range(4):
            all_J_1.append(
                universal_element.calc_J_1(J_matrices[i], all_det_J[i]))
        byX, byY = universal_element.calc_deXY(all_J_1)
        dx_dx_T = []
        for i in range(4):
            dx_dx_T.append(universal_element.multiply_vector(byX[i]))
Esempio n. 12
0
 
Additionally, compute the longitudinal stress in the fuselage skin (in MPa or MegaPascal):
'''

altitude = 6200.0
pressure_cabin_ratio = 0.8

fuselage_radius = 3.2
skin_thickness = 0.0024

(_, pressure_alt, _) = ISA.atmospheric_details(altitude)
pressure_cabin = pressure_cabin_ratio*ISA.pressure_at_sea_level
pressure_difference = pressure_cabin-pressure_alt

stress_circumferential = Structures.stress_circumferential(
							pressure_difference,
							fuselage_radius,
							skin_thickness)

stress_circumferential_MPa = stress_circumferential/10.0**6

print(stress_circumferential_MPa)

stress_longitudinal = Structures.stress_longitudinal(
						pressure_difference,
						fuselage_radius,
						skin_thickness)

stress_longitudinal_MPa = stress_longitudinal/10.0**6

print(stress_longitudinal_MPa)
Esempio n. 13
0
from keras.layers import Bidirectional, Dropout, Flatten
from keras.layers.merge import Dot
import keras
from keras_self_attention import SeqSelfAttention
from pydub import AudioSegment

graph = tf.get_default_graph()

ft = FeatureExtractor('mean_std.csv', BIT_PRECISION=16, sampling_rate=8000)
#em = EmotionExtractor_tf.EmotionExtractor('baseline_context5_conv_simple2.weights', 'mean_std.csv')

sequences_length = 256
classes = 4
context_len = 5

structure = str2.Structures(context_len, 136, classes, 256)
my_attention_network = structure.structure_11_LCA_attention_dot3()
my_attention_network.load_weights("vera_4_classes_lca_attention.npy")

intermediate_model = Model(inputs=my_attention_network.input,
                           outputs=my_attention_network.layers[-3].output)

from keras.models import load_model


def create_stress_model():
    model_nn = Sequential()
    model_nn.add(
        Bidirectional(LSTM(64, return_sequences=True),
                      input_shape=(256, 256),
                      name="LSTM_Layer"))  # you can add a label