def save_dfield_to_png(container, datafield_name, filename, run_type): """ Save desired datafield given by name stored in container to file. @param container: gwy.Container which has datafield of given name @param datafield_name: datafield name in string representation (like '/0/data') @param filename: expected filename @param run_type: select of interactive (RUN_INTERACTIVE) or noninteractive mode (RUN_NONINTERACTIVE) """ gwy.gwy_app_data_browser_reset_visibility(container, gwy.VISIBILITY_RESET_SHOW_ALL) datafield_num = int(datafield_name.split('/')[1]) gwy.gwy_app_data_browser_select_data_field(container, datafield_num) gwy.gwy_file_save(container, filename, run_type)
# Stupid bloody /0/data/nonsense key = "/"+str(data_set)+"/data" data = datafields[key] # Plane level a, bx, by = data.fit_plane() data.plane_level(a, bx, by) # Median line correction data = line_correct_median(data) # Fix zero data.add(-1.0 * data.get_min()) # Set colour range base = "/"+str(data_set)+"/base" container.set_int32_by_name(base+"/range-type", 1) container.set_double_by_name(base+"/min", colour_min) container.set_double_by_name(base+"/max", colour_max) container.set_string_by_name(base+"/palette", palette) # Do silly things required to save gwy.gwy_app_data_browser_reset_visibility(container, gwy.VISIBILITY_RESET_SHOW_ALL) gwy.gwy_app_data_browser_select_data_field(container, data_set) if saved_once: gwy.gwy_file_save(container, out_file, gwy.RUN_NONINTERACTIVE) else: gwy.gwy_file_save(container, out_file, gwy.RUN_INTERACTIVE) saved_once = True gwy.gwy_app_data_browser_reset_visibility(container, gwy.VISIBILITY_RESET_HIDE_ALL)