Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 8c6acf03 authored by ulrich_y's avatar ulrich_y
Browse files

6: load dataset by regex in re #17

parent accbefa6
No related branches found
No related tags found
No related merge requests found
...@@ -4,3 +4,4 @@ import matplotlib.pyplot as plt ...@@ -4,3 +4,4 @@ import matplotlib.pyplot as plt
from vegas import importvegas from vegas import importvegas
from errortools import mergenumbers, plusnumbers, dividenumbers, timesnumbers,\ from errortools import mergenumbers, plusnumbers, dividenumbers, timesnumbers,\
mergeplots, addplots, combineNplots, scaleplot mergeplots, addplots, combineNplots, scaleplot
from loader import importreg, pattern
import re
from vegas import importvegas
import os
def importreg(r, folder='.', filenames=None,
merge={}, types=[int,float,float]):
if filenames is None:
filenames = os.listdir(folder)
dic = {}
for filename in filenames:
m = re.match(r, filename)
if m:
v = importvegas(os.path.join(folder, filename))
for p, n in merge.iteritems():
if n > 0:
v[p] = mergebins(v[p], n)
if len(types) == len(m.groups()):
k = tuple(f(v) for v,f in zip(m.groups(), types))
else:
k = m.groups()
dic[k] = v
return dic
def pattern(piece='.*', flavour='.*', obs='', folderp='.*'):
if len(obs) > 0:
return (
folderp + piece + '_' + flavour + '_S(\d+)X([\d\.]+)D([\d\.]+).*'
)
else:
return (
folderp + piece + '_' + flavour + '_S(\d+)X([\d\.]+)D([\d\.]+).*'
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment