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

Method __mul__

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

Source from the content-addressed store, hash-verified

270 return result
271
272 def __mul__(self, other):
273 if isinstance(other, Analysis):
274 if other.range != self.range:
275 raise ValueError("Can't multiply! Both Analysis have " +
276 "different band limits.")
277 anType='mixed'
278 data=self.data*other.data
279 elif isinstance(other, (int, float)):
280 anType='mixed'
281 data=self.data*other
282 else:
283 raise TypeError("Analysis can only be operated with int, float, " +
284 "or Analysis types.")
285 selfDataLabel = self.dataLabel if self.dataLabel is not None \
286 else 'Analysis 1'
287 if hasattr(other,'dataLabel'):
288 if other.dataLabel is not None:
289 otherDataLabel = other.dataLabel
290 else:
291 otherDataLabel = 'Analysis 2'
292 else:
293 otherDataLabel = 'Analysis 2'
294 result = Analysis(anType=anType, nthOct=self.nthOct,
295 minBand=self.minBand, maxBand=self.maxBand,
296 data=data, dataLabel=selfDataLabel +
297 ' * ' + otherDataLabel,
298 error=None, errorLabel=None,
299 comment=None,
300 xLabel=self.xLabel, yLabel=self.yLabel,
301 title=None)
302 return result
303
304 def __rtruediv__(self, other):
305 if isinstance(other, Analysis):

Callers

nothing calls this directly

Calls 1

AnalysisClass · 0.85

Tested by

no test coverage detected