pothosware / PothosComms

Communications blocks and support libraries
https://github.com/pothosware/PothosComms/wiki
Boost Software License 1.0
19 stars 12 forks source link

FIR designer - bounds checks dont throw #10

Closed guruofquality closed 9 years ago

guruofquality commented 9 years ago

The exceptions are missing throws. On top of that it looks like after adding in the throws, two of the checks are actually wrong. The "frequency must be positive" checks dont apply when the filter type is complex. For complex they should be checking against -_sampRate/2.

audiofilter commented 9 years ago

Oops. I added the throws & pushed without checking if they work! Since I started I'll try to fix it

audiofilter commented 9 years ago

Actually I'm going to punt on this for now. I don't understand why it should be < -sampRate/2 I'm also getting

Out of Range : cannot convert (some complex number...) with imaginary components into type real (Sorry I couldn't cut and paste error directly).

If you want me to back out the change for now let me know

guruofquality commented 9 years ago

Actually I'm going to punt on this for now. I don't understand why it should be < -sampRate/2

I pushed the change. I just meant that when the filter produces complex taps that the upper and lower frequencies can be +/- sampleRate/2. The current checks didn't allow for negative frequencies.

Out of Range : cannot convert (some complex number...) with imaginary components into type real

No idea. If the error is still around, let me know what reproduces it

audiofilter commented 9 years ago

Yes, still seeing it, with this setup https://github.com/audiofilter/pothos_sandbox/blob/master/test_freq_xlating_fir_filter.pth

Perhaps you can't have a complex bandpass filter that is actually a 'real' bandpass filter?

2015-10-31 21:30:35 Pothos.Block.callSlot: FIRFilter0[setTaps]: Out of range: cannot convert value (0.000739 + I*0.001017) with imaginary component into real type double 2015-10-31 21:30:35 Pothos.Block.callSlot: FIRDesigner0[setFrequencyUpper]: Exception: FIRDesigner(): upper frequency <= lower frequency 2015-10-31 21:31:06 PothosGui.TopologyEval.commit: Framework Topology Connect Error: Pothos::Topology::commit(): Framework Topology Connect Error: FIRDesigner0.activate(): Exception: FIRDesigner(): upper frequency <= lower frequency

guruofquality commented 9 years ago

cannot convert value (0.000739 + I*0.001017) with imaginary component into real type double

The complex bandpass and bandstop generate complex taps which are really just frequency shifted low/high pass filter. This lets you select any arbitrary range of frequencies between -rate/2 to rate/2. But this only works when you have complex samples and the complex FIR filter. So this error should be expected.

FIRDesigner(): upper frequency <= lower frequency

This is just a matter of the slider emiting a upper frequency that's lower than the lowerFreq of 100000. So I think everything is working as expected

guruofquality commented 9 years ago

We fixed this a while ago. Thanks, closing!