aboutsummaryrefslogtreecommitdiff
path: root/qolab/file_utils/__init__.py
blob: 044f3c70903c4968533e5da8dc24819d1aba27a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import platform
import re
import os

def filename2os_fname( fname ):
    # filename2os_fname translate Win or Linux fname to OS dependent style
    # takes in account the notion of 'Z:' drive on different systems
    # Z:\dir1\dir2\file   <==> /mnt/qol_grp_data/dir1/dir2/file
    if platform.system() == 'Windows':
        fname = re.sub('/mnt/qol_grp_data', 'Z:', fname)
    else:
        fname = re.sub('Z:', '/mnt/qol_grp_data', fname)
        fname = re.sub(r'\\', '/', fname)

    fname = os.path.normpath(fname)
    return (fname)


def get_runnum(savepath):
    # For the provided datapath:
    #  reads, increments data counter and saves it back.
    # If nesessary creates counter file and full path to it.
    # example
    #  get_runnum('Z:\Ramsi_EIT\data\')
    #  get_runnum('/mnt/qol_grp_data/data')
    pass

def get_next_data_file(prefix, savepath):
    run_number = get_runnum( savepath )