A simple question from a beginner

Hi frnds

I am new to GNURadio and I have a simple question the answer to which I
cannot find. I tried all kinds of methods to know what’s happening. This
is
my last way to know the answer. I am looking at tunnel.py in
gnuradio/examples/digital directory. In this module in the main()
function
we initialize the variable “mods” as

mods = modulation_utils.type_1_mods()

The modulation_utils.type_1_mods() returns the variable
_type_1_modulators.
This variable is actually initialized as an empty dictionary object {},
but
when it returns to tunnel.py it returns a dictionary modulators info. I
cannot find where this initialization is being done. I checked almost
everything, all the import modules, etc. I tried debugging using pdb and
a
lot of print statements, but still can’t find the answer to it. Can
anyone
throw some light on it.

_type_1_modulators = {}

something seems to happen between these two lines. I don’t know what.

def type_1_mods():
print “inside function”
print _type_1_modulators
return _type_1_modulators

Thanking you
Ali

On Fri, Apr 25, 2008 at 12:16:02AM -0500, Murtuza wrote:

The modulation_utils.type_1_mods() returns the variable _type_1_modulators.

def type_1_mods():
print “inside function”
print _type_1_modulators
return _type_1_modulators

Thanking you
Ali

The mod/demod code registers themselves when they are loaded.
See for example the last two lines in
gnuradio-core/src/gnuradio/blks2impl/dbpsk.py

Add these to the mod/demod registry

modulation_utils.add_type_1_mod(‘dbpsk’, dbpsk_mod)
modulation_utils.add_type_1_demod(‘dbpsk’, dbpsk_demod)