# Some noodling

**URL:** <https://www.ruby-forum.com/t/some-noodling/146309>\
**Category:** GNU Radio\
**Created:** [August 19, 2008, 11:01pm UTC](https://www.ruby-forum.com/t/some-noodling/146309 "2008-08-19T23:01:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcus\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@Marcus\_L](https://www.ruby-forum.com/u/Marcus_L)\
**Post date:** [August 19, 2008, 11:01pm UTC](https://www.ruby-forum.com/t/some-noodling/146309/1 "2008-08-19T23:01:26Z")

</div>

I want to write a dicke-switched type system for my existing  
un-calibrated radiometry application (usrp\_ra\_receiver.py).

Controlling the switching function is no problem. But processing the  
samples as they come in has me a bit stumped,  
unless I write a custom-processing block.

So, the input switches at some rate (a few Hz), which means that the  
samples sometimes represent the “sky”, and  
sometimes represent the calibrator. I can tag the samples so that  
samples that come in during the time when  
the input is “sky” will be positive, and those that come in during  
“calibration” will be negative. But after that, I’m  
not sure what to do. But perhaps something clever will occur to me  
or someone on the list.

Also, I need a way of triggering switching at rates faster than 1Hz.  
One I idea I had was to create a side-chain  
off of the USRP which uses keep\_one\_in\_n() to reduce the sample rate,  
and have this terminate in a Python  
function (is that possible yet, and if so, how?) that ignores the  
data, but simply uses that as a timing mechanism  
to drive the switching function.

Cheers  
Marcus

---

<div class="post-metadata">

**Author:** ![Marcus\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@Marcus\_L](https://www.ruby-forum.com/u/Marcus_L)\
**Post date:** [August 20, 2008, 6:26pm UTC](https://www.ruby-forum.com/t/some-noodling/146309/2 "2008-08-20T18:26:08Z")

</div>

On Tue, Aug 19, 2008 at 2:00 PM, Marcus L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Controlling the switching function is no problem. But processing the  
> samples as they come in has me a bit stumped,  
> unless I write a custom-processing block.

This is your best bet.

> So, the input switches at some rate (a few Hz), which means that the samples  
> sometimes represent the “sky”, and  
> sometimes represent the calibrator. I can tag the samples so that samples  
> that come in during the time when  
> the input is “sky” will be positive, and those that come in during  
> “calibration” will be negative.

It’s pretty straightforward to write a new block that only passes  
positive samples (or negative, depending on a constructor parameter.)  
Then you’d attach two of these to the output of your usrp block and  
you’ll have the two streams you need.

–  
Johnathan C.  
Corgan Enterprises LLC  
[http://corganenterprises.com/](http://corganenterprises.com/)

---

<div class="post-metadata">

**Author:** ![Marcus\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@Marcus\_L](https://www.ruby-forum.com/u/Marcus_L)\
**Post date:** [August 20, 2008, 10:39pm UTC](https://www.ruby-forum.com/t/some-noodling/146309/3 "2008-08-20T22:39:19Z")

</div>

Turns out I didn’t need to write a new block, but rather through clever  
abuse of  
keep\_one\_in\_n(), I was able to implement a cheap “mute and pause”.  
Which means that  
I can control the two different streams, and control what gets to the  
final integrator.

While we’re in “switched” mode, I simply pause the main chain, and only  
the side-chain  
gets data, and visa versa. The side-chain data are used to drive a  
short-term estimate  
of the reference signal power, which gets subtracted on the main  
chain.
