Options

"Frequency notch filtering, is it possible?"

awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
edited May 2019 in Help
Hello all,

I've been trying to find a way (after a Fourier transform) to filter out all but a very narrow band of frequencies so I can concentrate on these in the classification process I have. Is there any way I could perform a logical AND on all members of a value series to eliminate all but the ones I want?

I've been trying to use FilterTransformation but I can't quite get the sharpness and I also can't think of a way to use SingleCombinedFunction (but I have been staring at it for too long perhaps).

Thanks in advance for any advice

best regards

Andrew
Tagged:

Answers

  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi Andrew,
    are you using the ValueSeries Plugin?

    Greetings,
      Sebastian
  • Options
    awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
    Hello Sebastian,

    Yes, I am using the value series plugin.

    regards,

    Andrew
  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi Andrew,
    you could filter out the according attribute using an AttributeFilter after the series processing, when everything is stored in an exampleSet again.
    If this doesn't work, please post your process below, so that I can see, what you are actually doing.

    Greetings,
      Sebastian
  • Options
    awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
    Hello Sebastian,

    Thanks - I get it now - I was trying to do too much with the value series operators I think. I've attached a cut down version of the process.
    <operator name="Root" class="Process" expanded="yes">
        <description text="Simply generates a sinus series and displays it."/>
        <operator name="SinusGenerator" class="SinusGenerator">
            <parameter key="number_of_values" value="1000"/>
            <list key="frequency">
              <parameter key="120" value="1.0"/>
              <parameter key="200" value="1.0"/>
              <parameter key="310" value="1.0"/>
            </list>
        </operator>
        <operator name="FastFourierTransform" class="FastFourierTransform">
            <parameter key="frequency_rescaling" value="true"/>
            <parameter key="sample_rate" value="1000.0"/>
        </operator>
        <operator name="SeriesObject2ExampleSet" class="SeriesObject2ExampleSet">
        </operator>
        <operator name="AttributeCopy" class="AttributeCopy">
            <parameter key="attribute_name" value="FFT(sinus)_index"/>
            <parameter key="new_name" value="frequency"/>
        </operator>
    </operator>
    In this example, I want to suppress all frequencies outside the range 175 to 225. I can't quite (yet  ;)) work out how to set the attribute FFT(sinus)_dim_1 to 0 when the frequency attribute in the same example is less than 175 or greater than 225.

    I'm guessing there's a neat way to do it but as usual I've been staring at it for too long. Any advice would be appreciated.

    best regards,

    Andrew
  • Options
    awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
    I figured out a way - it's attached.
    <operator name="Root" class="Process" expanded="yes">
        <description text="Simply generates a sinus series and displays it."/>
        <operator name="SinusGenerator" class="SinusGenerator">
            <parameter key="number_of_values" value="1000"/>
            <list key="frequency">
              <parameter key="120" value="1.0"/>
              <parameter key="200" value="1.0"/>
              <parameter key="310" value="1.0"/>
            </list>
        </operator>
        <operator name="FastFourierTransform" class="FastFourierTransform">
            <parameter key="frequency_rescaling" value="true"/>
            <parameter key="sample_rate" value="1000.0"/>
        </operator>
        <operator name="SeriesObject2ExampleSet" class="SeriesObject2ExampleSet">
        </operator>
        <operator name="AttributeCopy" class="AttributeCopy">
            <parameter key="attribute_name" value="FFT(sinus)_index"/>
            <parameter key="new_name" value="frequency"/>
        </operator>
        <operator name="Change frequency to label" class="ChangeAttributeRole">
            <parameter key="name" value="frequency"/>
            <parameter key="target_role" value="label"/>
        </operator>
        <operator name="Remove brackets so construction works" class="AttributeCopy">
            <parameter key="attribute_name" value="FFT(sinus)_dim_1"/>
            <parameter key="new_name" value="value"/>
        </operator>
        <operator name="AttributeConstruction" class="AttributeConstruction">
            <list key="function_descriptions">
              <parameter key="filteredFFTResult" value="if (frequency &gt; 175 &amp;&amp; frequency &lt; 225, value,0)"/>
            </list>
            <parameter key="use_standard_constants" value="false"/>
            <parameter key="keep_all" value="false"/>
        </operator>
    </operator>
    I'm guessing that there might be better ways.

    Thanks for spending time on this.

    Andrew
Sign In or Register to comment.