import re


def parse_basename(bname):
    """return tuple (tsh, axis, ddd, hh, this_file, total_files) given basename"""
    # input like BXM00018.15R
    m = re.match('(?P<tsh>.)(?P<axis>.)(.)(?P<day>\d{3})(?P<hour>\d{2})\.(?P<this_file>\d)(?P<num_files>\d).', bname)
    if m:
        return m.group('tsh'), m.group('axis'),\
               m.group('day'), m.group('hour'),\
               m.group('this_file'), m.group('num_files')
    else:
        return None