Example #1
0
def mul_split(file_path):
    """Splits all data channels into single gwy files"""

    m_id = data.m_id(file_path)
    dir_path = os.path.dirname(os.path.abspath(file_path))
    con = gwy.gwy_app_file_load(file_path)
    ch_ids = gwy.gwy_app_data_browser_get_data_ids(con)

    def inner(int_id):  # pylint: disable=missing-docstring
        new_container = gwy.Container()
        gwy.gwy_app_data_browser_add(new_container)
        gwy.gwy_app_data_browser_copy_channel(con, int_id, new_container)
        file_name = str(m_id) + "_" + str(int_id) + ".gwy"
        file_out = os.path.join(dir_path, file_name)
        meta_id = get_meta_ids(new_container)[0]
        time_extract = new_container[meta_id]["Date"]
        time_reformat = datetime.strptime(time_extract, "%Y-%m-%d %H:%M:%S")
        gwy.gwy_app_file_write(new_container, file_out)
        time_sec = time.mktime(time_reformat.timetuple())
        os.utime(file_out, (time_sec, time_sec))
        return file_out

    return [inner(ch_id) for ch_id in ch_ids]
# Script starts here
#
################################################################################

fl = open(file_list, 'r')
files = " ".join(fl.readlines()).split() # Ha, do that in Matlab!
fl.close()

saved_once = False

for f in files:

  mtrx_file = join(path_root, f)
  out_file = join(path_root, f) + "." + file_type
  
  container = gwy.gwy_app_file_load(mtrx_file)
  datafields = gwyutils.get_data_fields_dir(container)
  
  # 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())
Example #3
0
import gwy
import gwyutils
import sys
filename = sys.argv[1]
# '/Users/pabloherrero/sabat/stm_data/november19_experiments/QE1/2019-11-12-QE1_001.sxm'

f = open(filename, "r")
container = gwy.gwy_app_file_load(filename)
ids = gwy.gwy_app_data_browser_get_data_ids(container)

cons = gwy.gwy_app_data_browser_get_containers()
for c in cons:
    dfields = gwyutils.get_data_fields_dir(c)
    for key in dfields.keys():
        datafield = dfields[key]
        print(datafield.get_xreal())

gwy.gwy_app_data_browser_select_data_field(container, ids[0])
container['/%u/base/palette' % ids[0]] = 'Gold'
gwy.gwy_process_func_run("level", container, gwy.RUN_INTERACTIVE)
gwy.gwy_process_func_run("scars_remove", container, gwy.RUN_INTERACTIVE)

gwy.gwy_file_save(container, '%s-%02u.png' % (basename, 0),
                  gwy.RUN_NONINTERACTIVE)
Example #4
0
 def open_file(self,widget,data):
     if self.current_data:
         gwy.gwy_app_file_load(self.current_data)
Example #5
0
 def open_file(self,widget,data):
     if self.param['full_path']:
         #self.current_data = data
         gwy.gwy_app_file_load(self.param['full_path'])