Ejemplo n.º 1
0
 def test_connections(self):
     """
     Tests the connections of the concatenation module.
     """
     ccs = sumpf.modules.ReverseSignal()
     self.assertEqual(ccs.SetInput.GetType(), sumpf.Signal)
     self.assertEqual(ccs.GetOutput.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self, inputs=[ccs.SetInput], noinputs=[], output=ccs.GetOutput)
Ejemplo n.º 2
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     edc = sumpf.modules.EnergyDecayCurveFromImpulseResponse()
     self.assertEqual(edc.SetImpulseResponse.GetType(), sumpf.Signal)
     self.assertEqual(edc.GetEnergyDecayCurve.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[edc.SetImpulseResponse],
                                      noinputs=[],
                                      output=edc.GetEnergyDecayCurve)
Ejemplo n.º 3
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     rms = sumpf.modules.RootMeanSquare()
     self.assertEqual(rms.SetInput.GetType(), sumpf.Signal)
     self.assertEqual(rms.SetIntegrationTime.GetType(), float)
     self.assertEqual(rms.GetOutput.GetType(), sumpf.Signal)
     common.test_connection_observers(
         testcase=self, inputs=[rms.SetInput, rms.SetIntegrationTime], noinputs=[], output=rms.GetOutput
     )
Ejemplo n.º 4
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     cnj = sumpf.modules.ConjugateSpectrum()
     self.assertEqual(cnj.SetInput.GetType(), sumpf.Spectrum)
     self.assertEqual(cnj.GetOutput.GetType(), sumpf.Spectrum)
     common.test_connection_observers(testcase=self,
                                      inputs=[cnj.SetInput],
                                      noinputs=[],
                                      output=cnj.GetOutput)
Ejemplo n.º 5
0
 def test_spectrum_variance_connectors(self):
     """
     Tests if the connectors of the SpectrumVariance class are properly decorated.
     """
     variance = sumpf.modules.SpectrumVariance()
     self.assertEqual(variance.SetSpectrum.GetType(), sumpf.Spectrum)
     self.assertEqual(variance.GetVariance.GetType(), tuple)
     common.test_connection_observers(testcase=self,
                                      inputs=[variance.SetSpectrum],
                                      noinputs=[],
                                      output=variance.GetVariance)
Ejemplo n.º 6
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     rec = sumpf.modules.RectifySignal()
     self.assertEqual(rec.SetInput.GetType(), sumpf.Signal)
     self.assertEqual(rec.GetOutput.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[rec.SetInput],
                                      noinputs=[],
                                      output=rec.GetOutput)
Ejemplo n.º 7
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     nrm = sumpf.modules.NormalizeSpectrumToFrequency()
     self.assertEqual(nrm.SetSpectrum.GetType(), sumpf.Spectrum)
     self.assertEqual(nrm.SetFrequency.GetType(), float)
     self.assertEqual(nrm.GetOutput.GetType(), sumpf.Spectrum)
     common.test_connection_observers(testcase=self,
                                      inputs=[nrm.SetSpectrum, nrm.SetFrequency],
                                      noinputs=[],
                                      output=nrm.GetOutput)
Ejemplo n.º 8
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     clip = sumpf.modules.ClipSignal()
     self.assertEqual(clip.SetInput.GetType(), sumpf.Signal)
     self.assertEqual(clip.SetThresholds.GetType(), collections.Iterable)
     self.assertEqual(clip.GetOutput.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[clip.SetInput, clip.SetThresholds],
                                      noinputs=[],
                                      output=clip.GetOutput)
Ejemplo n.º 9
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     drv = sumpf.modules.DifferentiateSignal()
     self.assertEqual(drv.SetInput.GetType(), sumpf.Signal)
     self.assertEqual(drv.SetFunction.GetType(), collections.Callable)
     self.assertEqual(drv.GetOutput.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[drv.SetInput, drv.SetFunction],
                                      noinputs=[],
                                      output=drv.GetOutput)
Ejemplo n.º 10
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     norm = sumpf.modules.NormalizeSignal()
     self.assertEqual(norm.SetSignal.GetType(), sumpf.Signal)
     self.assertEqual(norm.SetIndividual.GetType(), bool)
     self.assertEqual(norm.GetOutput.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[norm.SetSignal, norm.SetIndividual],
                                      noinputs=[],
                                      output=norm.GetOutput)
Ejemplo n.º 11
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     log = sumpf.modules.LogarithmSignal()
     self.assertEqual(log.SetInput.GetType(), sumpf.Signal)
     self.assertEqual(log.SetBase.GetType(), float)
     self.assertEqual(log.GetOutput.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[log.SetInput, log.SetBase],
                                      noinputs=[],
                                      output=log.GetOutput)
Ejemplo n.º 12
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     # FourierTransform
     ins = sumpf.modules.IntegrateSignal()
     self.assertEqual(ins.SetInput.GetType(), sumpf.Signal)
     self.assertEqual(ins.SetOffset.GetType(), float)
     self.assertEqual(ins.GetOutput.GetType(), sumpf.Signal)
     common.test_connection_observers(
         testcase=self, inputs=[ins.SetInput, ins.SetOffset], noinputs=[], output=ins.GetOutput
     )
Ejemplo n.º 13
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     cnv = sumpf.modules.ConvolveSignals()
     self.assertEqual(cnv.SetInput1.GetType(), sumpf.Signal)
     self.assertEqual(cnv.SetInput2.GetType(), sumpf.Signal)
     self.assertEqual(cnv.SetConvolutionMode.GetType(), type(sumpf.modules.ConvolveSignals.FULL))
     self.assertEqual(cnv.GetOutput.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[cnv.SetInput1, cnv.SetInput2, cnv.SetConvolutionMode],
                                      noinputs=[],
                                      output=cnv.GetOutput)
Ejemplo n.º 14
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     gen = sumpf.modules.DerivativeSpectrumGenerator()
     self.assertEqual(gen.SetLength.GetType(), int)
     self.assertEqual(gen.SetResolution.GetType(), float)
     self.assertEqual(gen.SetMaximumFrequency.GetType(), float)
     self.assertEqual(gen.GetSpectrum.GetType(), sumpf.Spectrum)
     common.test_connection_observers(testcase=self,
                                      inputs=[gen.SetLength, gen.SetResolution, gen.SetMaximumFrequency],
                                      noinputs=[],
                                      output=gen.GetSpectrum)
Ejemplo n.º 15
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     gen = sumpf.modules.ConstantSignalGenerator()
     self.assertEqual(gen.SetValue.GetType(), float)
     self.assertEqual(gen.SetLength.GetType(), int)
     self.assertEqual(gen.SetSamplingRate.GetType(), float)
     self.assertEqual(gen.GetSignal.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[gen.SetValue, gen.SetLength, gen.SetSamplingRate],
                                      noinputs=[],
                                      output=gen.GetSignal)
Ejemplo n.º 16
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     cut = sumpf.modules.ShiftSignal()
     self.assertEqual(cut.SetInput.GetType(), sumpf.Signal)
     self.assertEqual(cut.SetShift.GetType(), int)
     self.assertEqual(cut.SetCircular.GetType(), bool)
     self.assertEqual(cut.GetOutput.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[cut.SetInput, cut.SetShift, cut.SetCircular],
                                      noinputs=[],
                                      output=cut.GetOutput)
Ejemplo n.º 17
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     d2l = sumpf.modules.DurationToLength()
     self.assertEqual(d2l.GetLength.GetType(), int)
     self.assertEqual(d2l.SetDuration.GetType(), float)
     self.assertEqual(d2l.SetSamplingRate.GetType(), float)
     self.assertEqual(d2l.SetEvenLength.GetType(), bool)
     common.test_connection_observers(testcase=self,
                                      inputs=[d2l.SetDuration, d2l.SetSamplingRate, d2l.SetEvenLength],
                                      noinputs=[],
                                      output=d2l.GetLength)
Ejemplo n.º 18
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     res = sumpf.modules.ResampleSignal()
     self.assertEqual(res.SetInput.GetType(), sumpf.Signal)
     self.assertEqual(res.SetSamplingRate.GetType(), float)
     self.assertEqual(res.SetAlgorithm.GetType(), int)
     self.assertEqual(res.GetOutput.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[res.SetInput, res.SetSamplingRate, res.SetAlgorithm],
                                      noinputs=[],
                                      output=res.GetOutput)
Ejemplo n.º 19
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     prp = sumpf.modules.ChannelDataProperties()
     self.assertEqual(prp.SetSignalLength.GetType(), int)
     self.assertEqual(prp.SetSamplingRate.GetType(), float)
     self.assertEqual(prp.SetSpectrumLength.GetType(), int)
     self.assertEqual(prp.SetResolution.GetType(), float)
     self.assertEqual(prp.SetSignal.GetType(), sumpf.Signal)
     self.assertEqual(prp.SetSpectrum.GetType(), sumpf.Spectrum)
     self.assertEqual(prp.GetSignalLength.GetType(), int)
     self.assertEqual(prp.GetSamplingRate.GetType(), float)
     self.assertEqual(prp.GetSpectrumLength.GetType(), int)
     self.assertEqual(prp.GetResolution.GetType(), float)
     common.test_connection_observers(testcase=self,
                                      inputs=[prp.SetSignalLength, prp.SetSpectrumLength, prp.SetSignal, prp.SetSpectrum],
                                      noinputs=[prp.SetSamplingRate, prp.SetResolution],
                                      output=prp.GetSignalLength)
     common.test_connection_observers(testcase=self,
                                      inputs=[prp.SetSamplingRate, prp.SetSpectrumLength, prp.SetResolution, prp.SetSignal, prp.SetSpectrum],
                                      noinputs=[prp.SetSignalLength],
                                      output=prp.GetSamplingRate)
     common.test_connection_observers(testcase=self,
                                      inputs=[prp.SetSignalLength, prp.SetSpectrumLength, prp.SetSignal, prp.SetSpectrum],
                                      noinputs=[prp.SetSamplingRate, prp.SetResolution],
                                      output=prp.GetSpectrumLength)
     common.test_connection_observers(testcase=self,
                                      inputs=[prp.SetSignalLength, prp.SetSamplingRate, prp.SetResolution, prp.SetSignal, prp.SetSpectrum],
                                      noinputs=[prp.SetSpectrumLength],
                                      output=prp.GetResolution)
Ejemplo n.º 20
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     ci = sumpf.modules.CreateInterval()
     self.assertEqual(ci.SetStart.GetType(), (int, float))
     self.assertEqual(ci.SetStop.GetType(), (int, float, NoneType))
     self.assertEqual(ci.SetNegativeStart.GetType(), bool)
     self.assertEqual(ci.SetNegativeStop.GetType(), bool)
     self.assertEqual(ci.GetInterval.GetType(), tuple)
     common.test_connection_observers(testcase=self,
                                      inputs=[ci.SetStart, ci.SetStop, ci.SetNegativeStart, ci.SetNegativeStop],
                                      noinputs=[],
                                      output=ci.GetInterval)
Ejemplo n.º 21
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     reg = sumpf.modules.RegularizedSpectrumInversion()
     self.assertEqual(reg.GetOutput.GetType(), sumpf.Spectrum)
     self.assertEqual(reg.SetSpectrum.GetType(), sumpf.Spectrum)
     self.assertEqual(reg.SetStartFrequency.GetType(), float)
     self.assertEqual(reg.SetStopFrequency.GetType(), float)
     self.assertEqual(reg.SetTransitionLength.GetType(), int)
     self.assertEqual(reg.SetEpsilonMax.GetType(), float)
     common.test_connection_observers(testcase=self,
                                      inputs=[reg.SetSpectrum, reg.SetStartFrequency, reg.SetStopFrequency, reg.SetTransitionLength, reg.SetEpsilonMax],
                                      noinputs=[],
                                      output=reg.GetOutput)
Ejemplo n.º 22
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     for m in [sumpf.modules.Add(),
               sumpf.modules.Subtract(),
               sumpf.modules.Multiply(),
               sumpf.modules.Divide()]:
         self.assertEqual(m.SetValue1.GetType(), None)
         self.assertEqual(m.SetValue2.GetType(), None)
         self.assertEqual(m.GetResult.GetType(), None)
         common.test_connection_observers(testcase=self,
                                          inputs=[m.SetValue1, m.SetValue2],
                                          noinputs=[],
                                          output=m.GetResult)
Ejemplo n.º 23
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     gen = sumpf.modules.LaguerreFunctionGenerator()
     self.assertEqual(gen.SetOrder.GetType(), int)
     self.assertEqual(gen.SetScalingFactor.GetType(), float)
     self.assertEqual(gen.SetGeneralizationOrder.GetType(), int)
     self.assertEqual(gen.SetLength.GetType(), int)
     self.assertEqual(gen.SetSamplingRate.GetType(), float)
     self.assertEqual(gen.GetSignal.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[gen.SetOrder, gen.SetScalingFactor, gen.SetGeneralizationOrder, gen.SetLength, gen.SetSamplingRate],
                                      noinputs=[],
                                      output=gen.GetSignal)
Ejemplo n.º 24
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     fhi = sumpf.modules.FindHarmonicImpulseResponse()
     self.assertEqual(fhi.GetHarmonicImpulseResponse.GetType(), sumpf.Signal)
     self.assertEqual(fhi.SetImpulseResponse.GetType(), sumpf.Signal)
     self.assertEqual(fhi.SetHarmonicOrder.GetType(), int)
     self.assertEqual(fhi.SetSweepStartFrequency.GetType(), float)
     self.assertEqual(fhi.SetSweepStopFrequency.GetType(), float)
     self.assertEqual(fhi.SetSweepDuration.GetType(), float)
     common.test_connection_observers(testcase=self,
                                      inputs=[fhi.SetImpulseResponse, fhi.SetHarmonicOrder, fhi.SetSweepStartFrequency, fhi.SetSweepStopFrequency, fhi.SetSweepDuration],
                                      noinputs=[],
                                      output=fhi.GetHarmonicImpulseResponse)
Ejemplo n.º 25
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     gen = sumpf.modules.SweepGenerator()
     self.assertEqual(gen.SetLength.GetType(), int)
     self.assertEqual(gen.SetSamplingRate.GetType(), float)
     self.assertEqual(gen.SetStartFrequency.GetType(), float)
     self.assertEqual(gen.SetStopFrequency.GetType(), float)
     self.assertEqual(gen.SetSweepFunction.GetType(), sumpf.internal.SweepFunction)
     self.assertEqual(gen.SetInterval.GetType(), tuple)
     self.assertEqual(gen.GetSignal.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[gen.SetLength, gen.SetSamplingRate, gen.SetStartFrequency, gen.SetStopFrequency, gen.SetSweepFunction, gen.SetInterval],
                                      noinputs=[],
                                      output=gen.GetSignal)
Ejemplo n.º 26
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     self.assertEqual(self.splitter.SetInput.GetType(), sumpf.Signal)
     self.assertEqual(self.splitter.SetOutputChannels.GetType(), tuple)
     self.assertEqual(self.splitter.GetOutput.GetType(), sumpf.Signal)
     self.assertEqual(self.splitter.GetNumberOfOutputChannels.GetType(), int)
     common.test_connection_observers(testcase=self,
                                      inputs=[self.splitter.SetInput, self.splitter.SetOutputChannels],
                                      noinputs=[],
                                      output=self.splitter.GetOutput)
     common.test_connection_observers(testcase=self,
                                      inputs=[self.splitter.SetInput, self.splitter.SetOutputChannels],
                                      noinputs=[],
                                      output=self.splitter.GetNumberOfOutputChannels)
Ejemplo n.º 27
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     cut = sumpf.modules.CutSignal()
     self.assertEqual(cut.SetInput.GetType(), sumpf.Signal)
     self.assertEqual(cut.SetStart.GetType(), int)
     self.assertEqual(cut.SetStop.GetType(), int)
     self.assertEqual(cut.SetInterval.GetType(), tuple)
     self.assertEqual(cut.GetOutput.GetType(), sumpf.Signal)
     self.assertEqual(cut.GetOutputLength.GetType(), int)
     common.test_connection_observers(testcase=self,
                                      inputs=[cut.SetInput, cut.SetStart, cut.SetStop, cut.SetInterval],
                                      noinputs=[],
                                      output=cut.GetOutput)
     common.test_connection_observers(testcase=self,
                                      inputs=[cut.SetInput, cut.SetStart, cut.SetStop, cut.SetInterval],
                                      noinputs=[],
                                      output=cut.GetOutputLength)
Ejemplo n.º 28
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     # FourierTransform
     fft = sumpf.modules.FourierTransform()
     self.assertEqual(fft.SetSignal.GetType(), sumpf.Signal)
     self.assertEqual(fft.GetSpectrum.GetType(), sumpf.Spectrum)
     common.test_connection_observers(testcase=self,
                                      inputs=[fft.SetSignal],
                                      noinputs=[],
                                      output=fft.GetSpectrum)
     # InverseFourierTransform
     ifft = sumpf.modules.InverseFourierTransform()
     self.assertEqual(ifft.SetSpectrum.GetType(), sumpf.Spectrum)
     self.assertEqual(ifft.GetSignal.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[ifft.SetSpectrum],
                                      noinputs=[],
                                      output=ifft.GetSignal)
Ejemplo n.º 29
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     # PassThroughSignal
     pt = sumpf.modules.PassThroughSignal()
     self.assertEqual(pt.SetSignal.GetType(), sumpf.Signal)
     self.assertEqual(pt.GetSignal.GetType(), sumpf.Signal)
     common.test_connection_observers(testcase=self,
                                      inputs=[pt.SetSignal],
                                      noinputs=[],
                                      output=pt.GetSignal)
     # PassThroughSpectrum
     pt = sumpf.modules.PassThroughSpectrum()
     self.assertEqual(pt.SetSpectrum.GetType(), sumpf.Spectrum)
     self.assertEqual(pt.GetSpectrum.GetType(), sumpf.Spectrum)
     common.test_connection_observers(testcase=self,
                                      inputs=[pt.SetSpectrum],
                                      noinputs=[],
                                      output=pt.GetSpectrum)
Ejemplo n.º 30
0
 def test_connectors(self):
     """
     Tests if the connectors are properly decorated.
     """
     all_parameters = set(["ThieleSmallParameters", "VoiceCoilResistance",
                           "VoiceCoilInductance", "ForceFactor", "SuspensionStiffness",
                           "MechanicalDamping", "DiaphragmMass", "DiaphragmArea",
                           "SuspensionCompliance", "DiaphragmRadius", "ResonanceFrequency",
                           "ElectricalQFactor", "MechanicalQFactor", "TotalQFactor",
                           "ResonanceImpedance", "EfficiencyBandwidthProduct"])
     additional_parameters = set(["MediumDensity", "SpeedOfSound"])
     ts_int = sumpf.modules.ThieleSmallParameterInterpretation()
     self.assertEqual(ts_int.SetThieleSmallParameters.GetType(), sumpf.ThieleSmallParameters)
     self.assertEqual(ts_int.GetThieleSmallParameters.GetType(), sumpf.ThieleSmallParameters)
     common.test_connection_observers(testcase=self,
                                      inputs=[getattr(ts_int, "Set" + p) for p in (all_parameters | additional_parameters)],
                                      noinputs=[],
                                      output=ts_int.GetThieleSmallParameters)
     for p in all_parameters - set(["ThieleSmallParameters"]):
         self.assertEqual(getattr(ts_int, "Get" + p).GetType(), float)
         self.assertEqual(getattr(ts_int, "Set" + p).GetType(), float)
         if p == "VoiceCoilInductance":
             common.test_connection_observers(testcase=self,
                                              inputs=[ts_int.SetThieleSmallParameters, ts_int.SetVoiceCoilInductance],
                                              noinputs=[getattr(ts_int, "Set" + q) for q in ((all_parameters | additional_parameters) - set(["VoiceCoilInductance", "ThieleSmallParameters"]))],
                                              output=ts_int.GetVoiceCoilInductance)
         else:
             common.test_connection_observers(testcase=self,
                                              inputs=[getattr(ts_int, "Set" + q) for q in ((all_parameters | additional_parameters) - set(["VoiceCoilInductance"]))],
                                              noinputs=[ts_int.SetVoiceCoilInductance],
                                              output=getattr(ts_int, "Get" + p))