def main(): out_folder = hp.create_folder('Release_check') main_log = open(os.path.join(out_folder, 'Main.log'), 'w+') for library in args.paths: while library[-1] == '/': library = library[:-1] individual_log = open(os.path.join(out_folder, library.split('')), 'w+') if not os.path.isdir(library): individual_log.write('Folder not found\nFAIL') individual_log.close() main_log.write("{} folder doesn't exist: Fail") # Skip because folder doesn't exist continue messages = [] # counts lib, db and aocv files lib_count = hp.count_files(os.path.join(MODELS_FOLDER, '*/.lib')) db_count = hp.count_files(os.path.join(MODELS_FOLDER, '*/.db')) aocv_count = hp.count_files(os.path.join(MODELS_FOLDER, '*/.aocv')) # checks if all dbs are newer than their lib counterparts lib_files = glob(os.path.join(MODELS_FOLDER, '*/.lib')) db_files = glob(os.path.join(MODELS_FOLDER, '*/.lib')) for db in db_files: for lib in lib_files: if lib.replace('.lib', '.db') == db: if os.path.getatime(lib) < os.path.getatime(): messages.append('Error lib is newer than db for {}'.format(lib)) break
def run(): num_classes = 2 image_shape = (160, 576) data_dir = './data' runs_dir = os.path.join('./runs', str(time.time())) helper.create_folder(runs_dir) tests.test_for_kitti_dataset(data_dir) # Download pretrained vgg model helper.maybe_download_pretrained_vgg(data_dir) with tf.Session() as sess: epochs = 48 batch_size = 5 correct_label = tf.placeholder(tf.int32, [None, None, None, num_classes], name='correct_label') learning_rate = tf.placeholder(tf.float32, name='learning_rate') # Path to vgg model vgg_path = os.path.join(data_dir, 'vgg') # Create function to get batches get_batches_fn = helper.gen_batch_function( os.path.join(data_dir, 'data_road/training'), image_shape) image_input, keep_prob, vgg_layer3_out, vgg_layer4_out, vgg_layer7_out = load_vgg( sess, vgg_path) output = layers(vgg_layer3_out, vgg_layer4_out, vgg_layer7_out, num_classes) logits, train_op, cross_entropy_loss = optimize( output, correct_label, learning_rate, num_classes) train_nn(sess, epochs, batch_size, get_batches_fn, train_op, cross_entropy_loss, image_input, correct_label, keep_prob, learning_rate) helper.save_inference_samples(runs_dir, data_dir, sess, image_shape, logits, keep_prob, image_input)
def main(): # Display Banner banner.banner() # Define Target target = input(Fore.GREEN + "[!] Enter Target IP: ") # Call Helper and Menu Functions file_location = h.dict_file() ssl = h.check_ssl() folder_name = h.create_folder() inp = menu.display_menu() # Start Scan start.start_scan(file_location, folder_name, ssl, target, inp)
temples['imgUrl_5'] = xls.GetSheetValue(row, col_imgUrl_5) temples['place'] = xls.GetSheetValue(row, col_place) temples['surPlace'] = helper.remove_substring( xls.GetSheetValue(row, col_place)) temples['longBrief'] = helper.capitalize_first( xls.GetSheetValue(row, col_longBrief)) \ .replace('\t', ' ').replace(' ', ' ') temples['srcUrl'] = xls.GetSheetValue(row, col_srcUrl) temples['eparchyUrl'] = xls.GetSheetValue(row, col_eparchyUrl) temples['abbots'] = helper.capitalize_first( xls.GetSheetValue(row, col_abbots)) entities.append(temples) except Exception as e: print(f'Exception input line in row {row}: {temples}') raise Exception(e) helper.clear_folder(helper.get_full_path(root_folder)) helper.create_folder(helper.get_full_path(root_folder)) for i in range(len(entities)): item = entities[i] filename = 'file{}.json'.format(i) filename = helper.get_full_path(os.path.join(root_folder, filename)) helper.save_json(item, filename) print("Completed read to json files") exit(0)
cell_path = os.path.join(general_path, file_name_all[:-5]) # load parameters with file(os.path.join(general_path, file_name_all), 'r') as fid: all_params = json.load(fid) cell_param_path = os.path.join(cell_path, 'cell/params', file_name_cell) with file(cell_param_path, 'r') as fid: cell_params = json.load(fid) new_cell_params, results = initiate_all(all_params=all_params, cell_params=cell_params, sim_neuron=sim_neuron, sim_field=sim_field) # save results v_ext, dipole, etc cell_results_path = os.path.join(cell_path, 'cell/results') hl.create_folder(cell_results_path) save_file = os.path.join(cell_results_path, file_name_cell[:-5] + '.npz') if sim_neuron and sim_field: # simulate all np.savez(save_file, xx=results['xx'],yy =results['yy'],Q=results['Q'],Q_len=results['Q_len'], I=results['I'], I_axial=results['I_axial'],v_ext=results['v_ext'],ppt_vecs=results['ppt_vecs'], seg_coords=results['seg_coords'], v_soma=results['v_soma']) elif sim_neuron: # simulate only neuron but not field np.savez(save_file, I=results['I'], I_axial=results['I_axial'],ppt_vecs=results['ppt_vecs'], seg_coords=results['seg_coords'], v_soma=results['v_soma']) else: # only get the structure of the neuron np.savez(save_file, ppt_vecs=results['ppt_vecs'], seg_coords=results['seg_coords'])