Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
		
						commit
						cb91911313
					
				| @ -57,7 +57,7 @@ from pylot.core.pick.compare import Comparison | |||||||
| from pylot.core.pick.utils import symmetrize_error | from pylot.core.pick.utils import symmetrize_error | ||||||
| from pylot.core.io.phases import picksdict_from_picks | from pylot.core.io.phases import picksdict_from_picks | ||||||
| import pylot.core.loc.nll as nll | import pylot.core.loc.nll as nll | ||||||
| from pylot.core.util.defaults import FILTERDEFAULTS, COMPNAME_MAP | from pylot.core.util.defaults import FILTERDEFAULTS, SetChannelComponents | ||||||
| from pylot.core.util.errors import FormatError, DatastructureError, \ | from pylot.core.util.errors import FormatError, DatastructureError, \ | ||||||
|     OverwriteError, ProcessingError |     OverwriteError, ProcessingError | ||||||
| from pylot.core.util.connection import checkurl | from pylot.core.util.connection import checkurl | ||||||
| @ -1199,10 +1199,12 @@ class MainWindow(QMainWindow): | |||||||
|         ''' |         ''' | ||||||
|         Plot waveform data to current plotWidget. |         Plot waveform data to current plotWidget. | ||||||
|         ''' |         ''' | ||||||
|  |         compclass = SetChannelComponents() | ||||||
|         zne_text = {'Z': 'vertical', 'N': 'north-south', 'E': 'east-west'} |         zne_text = {'Z': 'vertical', 'N': 'north-south', 'E': 'east-west'} | ||||||
|         comp = self.getComponent() |         comp = self.getComponent() | ||||||
|         title = 'section: {0} components'.format(zne_text[comp]) |         title = 'section: {0} components'.format(zne_text[comp]) | ||||||
|         alter_comp = COMPNAME_MAP[comp] |         alter_comp = compclass.getCompPosition(comp) | ||||||
|  |         alter_comp = str(alter_comp[0]) | ||||||
|         wfst = self.get_data().getWFData().select(component=comp) |         wfst = self.get_data().getWFData().select(component=comp) | ||||||
|         wfst += self.get_data().getWFData().select(component=alter_comp) |         wfst += self.get_data().getWFData().select(component=alter_comp) | ||||||
|         height_need = len(self.data.getWFData())*12 |         height_need = len(self.data.getWFData())*12 | ||||||
|  | |||||||
| @ -55,9 +55,28 @@ OUTPUTFORMATS = {'.xml': 'QUAKEML', | |||||||
| 
 | 
 | ||||||
| LOCTOOLS = dict(nll=nll, hyposat=hyposat, velest=velest, hypo71=hypo71, hypodd=hypodd) | LOCTOOLS = dict(nll=nll, hyposat=hyposat, velest=velest, hypo71=hypo71, hypodd=hypodd) | ||||||
| 
 | 
 | ||||||
| COMPPOSITION_MAP = dict(Z=2, N=1, E=0) |  | ||||||
| COMPPOSITION_MAP['1'] = 1 |  | ||||||
| COMPPOSITION_MAP['2'] = 0 |  | ||||||
| COMPPOSITION_MAP['3'] = 2 |  | ||||||
| 
 | 
 | ||||||
| COMPNAME_MAP = dict(Z='3', N='1', E='2') | class SetChannelComponents: | ||||||
|  |     def getdefaultCompPosition(): | ||||||
|  |         # default component order | ||||||
|  |         CompPosition_Map = dict(Z=2, N=1, E=0) | ||||||
|  |         CompPosition_Map['1'] = 1 | ||||||
|  |         CompPosition_Map['2'] = 0 | ||||||
|  |         CompPosition_Map['3'] = 2 | ||||||
|  |         CompName_Map = dict(Z='3', N='1', E='2') | ||||||
|  |         CompName_Map['1'] = str(1) | ||||||
|  |         CompName_Map['2'] = str(2) | ||||||
|  |         CompName_Map['3'] = str(3) | ||||||
|  |         return CompPosition_Map, CompName_Map | ||||||
|  | 
 | ||||||
|  |     CompPosition_Map, CompName_Map = getdefaultCompPosition() | ||||||
|  | 
 | ||||||
|  |     def setCompPosition(self, component, position): | ||||||
|  |        self.CompPosition_Map[component] = position | ||||||
|  |        self.CompName_Map[component] = str(position) | ||||||
|  | 
 | ||||||
|  |     def getCompPosition(self, component):  | ||||||
|  |         self.comppos = self.CompPosition_Map[component] | ||||||
|  |         self.compname = self.CompName_Map[component]  | ||||||
|  |         return self.comppos, self.compname  | ||||||
|  |     | ||||||
|  | |||||||
| @ -36,7 +36,7 @@ from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin, \ | |||||||
|     getResolutionWindow |     getResolutionWindow | ||||||
| from pylot.core.pick.compare import Comparison | from pylot.core.pick.compare import Comparison | ||||||
| from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, LOCTOOLS, \ | from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, LOCTOOLS, \ | ||||||
|     COMPPOSITION_MAP, COMPNAME_MAP |     SetChannelComponents | ||||||
| from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \ | from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \ | ||||||
|     demeanTrace, isSorted, findComboBoxIndex, clims |     demeanTrace, isSorted, findComboBoxIndex, clims | ||||||
| from autoPyLoT import autoPyLoT | from autoPyLoT import autoPyLoT | ||||||
| @ -437,13 +437,15 @@ class WaveformWidget(FigureCanvas): | |||||||
|         self.clearPlotDict() |         self.clearPlotDict() | ||||||
|         wfstart, wfend = full_range(wfdata) |         wfstart, wfend = full_range(wfdata) | ||||||
|         nmax = 0 |         nmax = 0 | ||||||
|  |         compclass = SetChannelComponents() | ||||||
|         for n, trace in enumerate(wfdata): |         for n, trace in enumerate(wfdata): | ||||||
|             channel = trace.stats.channel |             channel = trace.stats.channel | ||||||
|             network = trace.stats.network |             network = trace.stats.network | ||||||
|             station = trace.stats.station |             station = trace.stats.station | ||||||
|             if mapping: |             if mapping: | ||||||
|                 comp = channel[-1] |                 comp = channel[-1] | ||||||
|                 n = COMPPOSITION_MAP[comp] |                 n = compclass.getCompPosition(str(comp)) | ||||||
|  |                 n = n[0] | ||||||
|             if n > nmax: |             if n > nmax: | ||||||
|                 nmax = n |                 nmax = n | ||||||
|             msg = 'plotting %s channel of station %s' % (channel, station) |             msg = 'plotting %s channel of station %s' % (channel, station) | ||||||
| @ -2004,18 +2006,19 @@ class PropertiesDlg(QDialog): | |||||||
|     @staticmethod |     @staticmethod | ||||||
|     def setValues(tabValues): |     def setValues(tabValues): | ||||||
|         settings = QSettings() |         settings = QSettings() | ||||||
|  |         compclass = SetChannelComponents() | ||||||
|         for setting, value in tabValues.items(): |         for setting, value in tabValues.items(): | ||||||
|             settings.setValue(setting, value) |             settings.setValue(setting, value) | ||||||
|             if value is not None: |             if value is not None: | ||||||
|                 if setting.startswith('Channel Z'): |                 if setting.startswith('Channel Z'): | ||||||
|                     COMPPOSITION_MAP['Z'] = value |                     component = 'Z' | ||||||
|                     COMPNAME_MAP['Z'] = value |                     compclass.setCompPosition(component, value) | ||||||
|                 elif setting.startswith('Channel E'): |                 elif setting.startswith('Channel E'): | ||||||
|                     COMPPOSITION_MAP['E'] = value |                     component = 'E' | ||||||
|                     COMPNAME_MAP['E'] = value |                     compclass.setCompPosition(component, value) | ||||||
|                 elif setting.startswith('Channel N'): |                 elif setting.startswith('Channel N'): | ||||||
|                     COMPPOSITION_MAP['N'] = value |                     component = 'N' | ||||||
|                     COMPNAME_MAP['N'] = value |                     compclass.setCompPosition(component, value) | ||||||
|         settings.sync() |         settings.sync() | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -2145,6 +2148,8 @@ class ChannelOrderTab(PropTab): | |||||||
|     def __init__(self, parent=None, infile=None): |     def __init__(self, parent=None, infile=None): | ||||||
|         super(ChannelOrderTab, self).__init__(parent) |         super(ChannelOrderTab, self).__init__(parent) | ||||||
| 
 | 
 | ||||||
|  |         compclass = SetChannelComponents() | ||||||
|  | 
 | ||||||
|         ChannelOrderLabelZ = QLabel("Channel Z [up/down, default=3]") |         ChannelOrderLabelZ = QLabel("Channel Z [up/down, default=3]") | ||||||
|         ChannelOrderLabelN = QLabel("Channel N [north/south, default=1]") |         ChannelOrderLabelN = QLabel("Channel N [north/south, default=1]") | ||||||
|         ChannelOrderLabelE = QLabel("Channel E [east/west, default=2]") |         ChannelOrderLabelE = QLabel("Channel E [east/west, default=2]") | ||||||
| @ -2157,9 +2162,13 @@ class ChannelOrderTab(PropTab): | |||||||
|         self.ChannelOrderEEdit = QLineEdit() |         self.ChannelOrderEEdit = QLineEdit() | ||||||
|         self.ChannelOrderEEdit.setMaxLength(1) |         self.ChannelOrderEEdit.setMaxLength(1) | ||||||
|         self.ChannelOrderEEdit.setFixedSize(20, 20) |         self.ChannelOrderEEdit.setFixedSize(20, 20) | ||||||
|         self.ChannelOrderZEdit.setText("3") |         # get channel order settings | ||||||
|         self.ChannelOrderNEdit.setText("1") |         zpos, zcomp = compclass.getCompPosition('Z') | ||||||
|         self.ChannelOrderEEdit.setText("2") |         epos, ecomp = compclass.getCompPosition('E') | ||||||
|  |         npos, ncomp = compclass.getCompPosition('N') | ||||||
|  |         self.ChannelOrderZEdit.setText("%s" % zcomp)  | ||||||
|  |         self.ChannelOrderNEdit.setText("%s" % ecomp) | ||||||
|  |         self.ChannelOrderEEdit.setText("%s" % ncomp) | ||||||
| 
 | 
 | ||||||
|         layout = QGridLayout() |         layout = QGridLayout() | ||||||
|         layout.addWidget(ChannelOrderLabelZ, 0, 0) |         layout.addWidget(ChannelOrderLabelZ, 0, 0) | ||||||
| @ -2186,6 +2195,10 @@ class ChannelOrderTab(PropTab): | |||||||
|                   "Channel E [east/west, default=2]": self.ChannelOrderEEdit.setText("%d" % Edefault)} |                   "Channel E [east/west, default=2]": self.ChannelOrderEEdit.setText("%d" % Edefault)} | ||||||
|         return values |         return values | ||||||
| 
 | 
 | ||||||
|  |     def getComponents(self): | ||||||
|  |   | ||||||
|  |         self.CompName = dict(Z='10', N='11', E='12') | ||||||
|  | 
 | ||||||
| class LocalisationTab(PropTab): | class LocalisationTab(PropTab): | ||||||
|     def __init__(self, parent=None, infile=None): |     def __init__(self, parent=None, infile=None): | ||||||
|         super(LocalisationTab, self).__init__(parent) |         super(LocalisationTab, self).__init__(parent) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user