Code Duplication    Length = 23-23 lines in 2 locations

rsudp/c_alert.py 1 location

@@ 65-87 (lines=23) @@
62
				self.filt = 'bandpass'
63
64
65
	def _set_deconv(self, deconv):
66
		'''
67
		This function sets the deconvolution units. Allowed values are as follows:
68
69
		.. |ms2| replace:: m/s\ :sup:`2`\
70
71
		- ``'VEL'`` - velocity (m/s)
72
		- ``'ACC'`` - acceleration (|ms2|)
73
		- ``'GRAV'`` - fraction of acceleration due to gravity (g, or 9.81 |ms2|)
74
		- ``'DISP'`` - displacement (m)
75
		- ``'CHAN'`` - channel-specific unit calculation, i.e. ``'VEL'`` for geophone channels and ``'ACC'`` for accelerometer channels
76
77
		:param str deconv: ``'VEL'``, ``'ACC'``, ``'GRAV'``, ``'DISP'``, or ``'CHAN'``
78
		'''
79
		deconv = deconv.upper() if deconv else False
80
		self.deconv = deconv if (deconv in rs.UNITS) else False
81
		if self.deconv and rs.inv:
82
			self.units = '%s (%s)' % (rs.UNITS[self.deconv][0], rs.UNITS[self.deconv][1]) if (self.deconv in rs.UNITS) else self.units
83
			printM('Signal deconvolution set to %s' % (self.deconv), self.sender)
84
		else:
85
			self.units = rs.UNITS['CHAN'][1]
86
			self.deconv = False
87
		printM('Alert stream units are %s' % (self.units.strip(' ').lower()), self.sender)
88
89
90
	def _find_chn(self):

rsudp/c_rsam.py 1 location

@@ 77-99 (lines=23) @@
74
		printM('Starting.', self.sender)
75
76
77
	def _set_deconv(self, deconv):
78
		"""
79
		This function sets the deconvolution units. Allowed values are as follows:
80
81
		.. |ms2| replace:: m/s\ :sup:`2`\
82
83
		- ``'VEL'`` - velocity (m/s)
84
		- ``'ACC'`` - acceleration (|ms2|)
85
		- ``'GRAV'`` - fraction of acceleration due to gravity (g, or 9.81 |ms2|)
86
		- ``'DISP'`` - displacement (m)
87
		- ``'CHAN'`` - channel-specific unit calculation, i.e. ``'VEL'`` for geophone channels and ``'ACC'`` for accelerometer channels
88
89
		:param str deconv: ``'VEL'``, ``'ACC'``, ``'GRAV'``, ``'DISP'``, or ``'CHAN'``
90
		"""
91
		deconv = deconv.upper() if deconv else False
92
		self.deconv = deconv if (deconv in rs.UNITS) else False
93
		if self.deconv and rs.inv:
94
			self.units = '%s (%s)' % (rs.UNITS[self.deconv][0], rs.UNITS[self.deconv][1]) if (self.deconv in rs.UNITS) else self.units
95
			printM('Signal deconvolution set to %s' % (self.deconv), self.sender)
96
		else:
97
			self.units = rs.UNITS['CHAN'][1]
98
			self.deconv = False
99
		printM('RSAM stream units are %s' % (self.units.strip(' ').lower()), self.sender)
100
101
102
	def _find_chn(self):