diff --git a/pylot/core/io/data.py b/pylot/core/io/data.py index 30d6694f..500a2cad 100644 --- a/pylot/core/io/data.py +++ b/pylot/core/io/data.py @@ -36,8 +36,17 @@ class Data(object): loaded event. Container object holding, e.g. phase arrivals, etc. """ - def __init__(self, parent=None, evtdata=None): + def __init__(self, parent=None, evtdata=None, picking_parameter=None): self._parent = parent + + if not picking_parameter: + if hasattr(parent, '_inputs'): + picking_parameter = parent._inputs + else: + logging.warning('No picking parameters found! Using default input parameters!!!') + picking_parameter = PylotParameter() + self.picking_parameter = picking_parameter + if self.getParent(): self.comp = parent.getComponent() else: @@ -403,23 +412,19 @@ class Data(object): not implemented: {1}'''.format(evtformat, e)) if fnext == '.cnv': try: - velest.export(picks_copy, fnout + fnext, eventinfo=self.get_evt_data()) + velest.export(picks_copy, fnout + fnext, self.picking_parameter, eventinfo=self.get_evt_data()) except KeyError as e: raise KeyError('''{0} export format not implemented: {1}'''.format(evtformat, e)) if fnext == '_focmec.in': try: - parameter = PylotParameter() - logging.warning('Using default input parameter') - focmec.export(picks_copy, fnout + fnext, parameter, eventinfo=self.get_evt_data()) + focmec.export(picks_copy, fnout + fnext, self.picking_parameter, eventinfo=self.get_evt_data()) except KeyError as e: raise KeyError('''{0} export format not implemented: {1}'''.format(evtformat, e)) if fnext == '.pha': try: - parameter = PylotParameter() - logging.warning('Using default input parameter') - hypodd.export(picks_copy, fnout + fnext, parameter, eventinfo=self.get_evt_data()) + hypodd.export(picks_copy, fnout + fnext, self.picking_parameter, eventinfo=self.get_evt_data()) except KeyError as e: raise KeyError('''{0} export format not implemented: {1}'''.format(evtformat, e)) diff --git a/pylot/core/io/phases.py b/pylot/core/io/phases.py index a80cd244..1f430f9f 100644 --- a/pylot/core/io/phases.py +++ b/pylot/core/io/phases.py @@ -760,7 +760,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None): # convert pick object (PyLoT) into dictionary evt = ope.Event(resource_id=eventinfo['resource_id']) evt.picks = arrivals - arrivals = picksdict_from_picks(evt) + arrivals = picksdict_from_picks(evt, parameter=parameter) # check for automatic and manual picks # prefer manual picks usedarrivals = chooseArrivals(arrivals) @@ -821,7 +821,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None): # convert pick object (PyLoT) into dictionary evt = ope.Event(resource_id=eventinfo['resource_id']) evt.picks = arrivals - arrivals = picksdict_from_picks(evt) + arrivals = picksdict_from_picks(evt, parameter=parameter) # check for automatic and manual picks # prefer manual picks usedarrivals = chooseArrivals(arrivals) @@ -872,7 +872,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None): # convert pick object (PyLoT) into dictionary evt = ope.Event(resource_id=eventinfo['resource_id']) evt.picks = arrivals - arrivals = picksdict_from_picks(evt) + arrivals = picksdict_from_picks(evt, parameter=parameter) # check for automatic and manual picks # prefer manual picks usedarrivals = chooseArrivals(arrivals)