MCPcopy Create free account
hub / github.com/PyTTaMaster/PyTTa / __rtruediv__

Method __rtruediv__

pytta/classes/analysis.py:304–352  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

302 return result
303
304 def __rtruediv__(self, other):
305 if isinstance(other, Analysis):
306 if self.anType == 'L':
307 if other.range != self.range:
308 raise ValueError("Can't divide! Both Analysis have" +
309 " different band limits.")
310 elif other.anType in ['mixed', 'C', 'D', 'RT']:
311 data = other.data / self.data
312 anType = 'mixed'
313 else:
314 raise NotImplementedError("Operation not implemented " +
315 "for Analysis types " +
316 anTypes[self.anType][1] +
317 " and " +
318 anTypes[other.anType][1] +
319 ".")
320 else:
321 data = other.data / self.data
322 anType = 'mixed'
323 elif isinstance(other, (int, float)):
324 if self.anType == 'L':
325 data = [10*np.log10(10**(dt/10) / other)
326 for dt in self.data]
327 anType = 'L'
328 else:
329 data = other / self.data
330 anType = 'mixed'
331 else:
332 raise NotImplementedError("Operation not implemented between " +
333 "Analysis and {}".format(type(other)) +
334 "types.")
335 selfDataLabel = self.dataLabel if self.dataLabel is not None \
336 else 'Analysis 1'
337 if hasattr(other,'dataLabel'):
338 if other.dataLabel is not None:
339 otherDataLabel = other.dataLabel
340 else:
341 otherDataLabel = 'Analysis 2'
342 else:
343 otherDataLabel = 'Analysis 2'
344 result = Analysis(anType=anType, nthOct=self.nthOct,
345 minBand=self.minBand, maxBand=self.maxBand,
346 data=data, dataLabel=selfDataLabel +
347 ' / ' + otherDataLabel,
348 error=None, errorLabel=None,
349 comment=None,
350 xLabel=self.xLabel, yLabel=self.yLabel,
351 title=None)
352 return result
353
354
355 def __truediv__(self, other):

Callers

nothing calls this directly

Calls 1

AnalysisClass · 0.85

Tested by

no test coverage detected