work_dir = main_work_dir.format(''.join(['t', str(itime)])) out_temp = [] #output_xy if not os.path.isdir(work_dir): os.makedirs(work_dir) out_fwd_dirs.append(work_dir) r2_dict = { 'survey_name': survey_name, 'survey_dir': work_dir, 'job_type': job_type, 'exe_dir': exe_dir, 'exe_name': 'R2.exe' } iR2 = r2_tools.R2(**r2_dict) r2_in_dict = { 'electrode_array': electrode_array, 'output_domain': out_temp, 'mesh_type': mesh_type, 'reg_elems': region_elems, 'res_matrix': 0, 'singular_type': 0, 'node_dict': node_dict } protocol_dict = {'meas_data': protocol_data} # ------------- Run R2 forward model ---------------- run_r2_dict = {
'zone': True } }, 'topo_correct': True, 'topo_dict': topo_dict } mr2.msh_to_dat(**to_dat_dict) #%% ############ Prepare R2 files ############## r2_dict = { 'survey_name': os.path.basename(stg_fname).split('.')[0], 'survey_dir': work_dir, 'job_type': 1, 'exe_dir': exe_dir, 'exe_name': 'R2.exe' } iR2 = r2_tools.R2(**r2_dict) # Define inversion output domain as foreground area foreground_nodes = np.hstack([ mr2.boundaries['foreground'][ikey][0] for ikey in mr2.boundaries['foreground']['order'] ]) foreground_nodes = np.hstack([foreground_nodes, foreground_nodes[0]]) foreground_xy = np.array( [mr2.mesh_dict['nodes'][inode - 1][:2] for inode in foreground_nodes]) mesh_type = 3 inv_options = {'a_wgt': 1e-2, 'error_mod': 2, 'inverse_type': 1} r2_in_dict = { 'electrode_array': mr2.electrode_array, 'output_domain': foreground_xy,