Commit 883d1b77 authored by Ask Hjorth Larsen's avatar Ask Hjorth Larsen
Browse files

move files around

parent 02c598c0
from __future__ import print_function
import sys
import setup_paths
from nomadcore.simple_parser import mainFunction, SimpleMatcher as SM
from nomadcore.local_meta_info import loadJsonFile, InfoKindEl
from nomadcore.unit_conversion.unit_conversion \
import register_userdefined_quantity
arg = sys.argv[1]
infoFileDescription = SM(
name='root',
weak=True,
startReStr='',
fixedStartValues={'program_name': 'siesta'},
sections=['section_run'],
subFlags=SM.SubFlags.Sequenced,
subMatchers=[
SM(r'Siesta Version: (?P<program_version>\S*)')
])
import sys, os, os.path
baseDir = os.path.dirname(os.path.abspath(__file__))
commonDir = os.path.normpath(os.path.join(baseDir,"../../../../python-common/common/python"))
if not commonDir in sys.path:
sys.path.insert(0, commonDir)
OCT_ENERGY_UNIT_NAME = 'usrOctEnergyUnit'
f_num = r'[-+]?(\d*\.\d+|\d+\.\d*)' # e.g.: 0.7 1. -.1
e_num = r'[-+]?\d*\.\d+[EeDd][-+]\d*' # e.g.: -7.642e-300
i_num = r'[-+\d]*'
def numpattern(id, unit=None, pattern=f_num):
if unit is None:
pat = r'(?P<%(id)s>%(pattern)s)'
else:
pat = r'(?P<%(id)s__%(unit)s>%(pattern)s)'
return pat % dict(id=id, unit=unit, pattern=pattern)
def pat(meta, regex):
return '(?P<%s>%s)' % (meta, regex)
def word(meta):
return pat(meta, regex=r'\S*')
def integer(meta):
return pat(meta, regex=i_num)
def floating(meta):
return pat(meta, regex='%s|%s' % (f_num, e_num))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment