[add] change seperator for event initiation from system specific to '/'

This commit is contained in:
Marcel Paffrath 2017-08-02 11:37:17 +02:00
parent d5645cf979
commit dfa04f7b0a

View File

@ -27,6 +27,7 @@ from pylot.core.util.structure import DATASTRUCTURE
from pylot.core.util.version import get_git_version as _getVersionString from pylot.core.util.version import get_git_version as _getVersionString
from pylot.core.util.event import Event from pylot.core.util.event import Event
from pylot.core.util.utils import real_None from pylot.core.util.utils import real_None
from pylot.core.util.defaults import SEPARATOR
__version__ = _getVersionString() __version__ = _getVersionString()
@ -60,7 +61,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
parameter = real_None(parameter) parameter = real_None(parameter)
inputfile = real_None(inputfile) inputfile = real_None(inputfile)
eventid = real_None(eventid) eventid = real_None(eventid)
locflag = 1 locflag = 1
if input_dict and isinstance(input_dict, dict): if input_dict and isinstance(input_dict, dict):
if 'parameter' in input_dict: if 'parameter' in input_dict:
@ -83,8 +84,9 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
parameter = PylotParameter(inputfile) parameter = PylotParameter(inputfile)
iplot = parameter['iplot'] iplot = parameter['iplot']
else: else:
print('No parameters set and no input file given. Choose either of both.') infile = os.path.join(os.path.expanduser('~'), '.pylot', 'pylot.in')
return print('Using default input file {}'.format(infile))
parameter = PylotParameter(infile)
else: else:
if not type(parameter) == PylotParameter: if not type(parameter) == PylotParameter:
print('Wrong input type for parameter: {}'.format(type(parameter))) print('Wrong input type for parameter: {}'.format(type(parameter)))
@ -92,7 +94,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
if inputfile: if inputfile:
print('Parameters set and input file given. Choose either of both.') print('Parameters set and input file given. Choose either of both.')
return return
data = Data() data = Data()
evt = None evt = None
@ -167,7 +169,12 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
if not events: if not events:
print('autoPyLoT: No events given. Return!') print('autoPyLoT: No events given. Return!')
return return
# transform system path separator to '/'
for index, event in enumerate(events):
event = event.replace(SEPARATOR, '/')
events[index] = event
for event in events: for event in events:
pylot_event = Event(event) #event should be path to event directory pylot_event = Event(event) #event should be path to event directory
data.setEvtData(pylot_event) data.setEvtData(pylot_event)