472,993 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 software developers and data experts.

1 program into another

Hi guys here is my problem ...

this is the source code I Have , honestly I hav no idea how it works bcos its too complicated for me ....

but my problem is ... i hav a freq comonent in it .... what I have to do with it is ... I need to take the output of the second program (which is the freq component ) and this Shud be the input for the program A

i am not sure bout the freq component too ....since i am unable to understand the program ... and even if I get the program where i shud insert it


#!/usr/bin/env python
# Copyright 2005, 2006 Free Software Foundation, Inc.
# This file is part of GNU Radio
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.

from gnuradio import gr, gru, modulation_utils
from gnuradio import usrp
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser

import random, time, struct, sys

# from current dir
from transmit_path import transmit_path
import fusb_options

#import os
#print os.getpid()
#raw_input('Attach and press enter')

class my_graph(gr.flow_graph):
def __init__(self, modulator_class, options):
self.txpath = transmit_path(self, modulator_class, options)

# /////////////////////////////////////////////////////////////////////////////
# main
# /////////////////////////////////////////////////////////////////////////////

def main():

def send_pkt(payload='', eof=False):
return fg.txpath.send_pkt(payload, eof)

def rx_callback(ok, payload):
print "ok = %r, payload = '%s'" % (ok, payload)

mods = modulation_utils.type_1_mods()

parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
expert_grp = parser.add_option_group("Expert")

parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(),
help="Select modulation from: %s [default=%%default]"
% (', '.join(mods.keys()),))

parser.add_option("-s", "--size", type="eng_float", default=1500,
help="set packet size [default=%default]")
parser.add_option("-M", "--megabytes", type="eng_float", default=1.0,
help="set megabytes to transmit [default=%default]")
parser.add_option("","--discontinuous", action="store_true", default=False,
help="enable discontinous transmission (bursts of 5 packets)")

transmit_path.add_options(parser, expert_grp)

for mod in mods.values():

(options, args) = parser.parse_args ()

if len(args) != 0:

if options.tx_freq is None:
sys.stderr.write("You must specify -f FREQ or --freq FREQ\n")

# build the graph
fg = my_graph(mods[options.modulation], options)

r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
print "Warning: failed to enable realtime scheduling"

fg.start() # start flow graph

# generate and send packets
nbytes = int(1e6 * options.megabytes)
n = 0
pktno = 0
pkt_size = int(options.size)

while n < nbytes:
send_pkt(struct.pack('!H', pktno) + (pkt_size - 2) * chr(pktno & 0xff))
n += pkt_size
if options.discontinuous and pktno % 5 == 4:
pktno += 1

fg.wait() # wait for it to finish

if __name__ == '__main__':
except KeyboardInterrupt:


a1 = [3, 2]
a2 = [7, 5]
a3 = [56, 242]
a4 = [3, 146]

sampDict = dict(zip([item[1] for item in [a1,a2,a3,a4]], [item[0] for item in [a1,a2,a3,a4]]))

max_samp = max(sampDict.keys())
freq = sampDict[max_samp]

print "The maximum sampling rate is %d using a frequency of %d." % (max_samp, freq)

output ot the prog (which is the input for the program A) = freq
Nov 30 '07 #1
0 1338

Sign in to post your reply or Sign up for a free account.

Similar topics

by: los | last post by:
Hi, I'm trying to create a program similar to that of Google's desktop that will crawl through the hard drive and index files. I have written the program and as of now I just put the thread to...
by: edgrsprj | last post by:
PROPOSED EARTHQUAKE FORECASTING COMPUTER PROGRAM DEVELOPMENT EFFORT Posted July 11, 2005 My main earthquake forecasting Web page is: http://www.freewebz.com/eq-forecasting/Data.html ...
by: bbxrider | last post by:
for win2k adv server/iis5.0 trying to run an external program from my asp routine that has multiple parameters, see following set shell = server.createobject("wscript.shell") shell.Run...
by: christopher diggins | last post by:
I am wondering if any can point me to any open-source library with program objects for C++ like there is in Java? I would like to be able to write things like MyProgram1 >> MyProgram2 >>...
by: tigrfire | last post by:
I've been working on a program to try and play a game of Craps, based on a version I found elsewhere - I didn't code the original, but I added a few things such as a balance and wager system. I'm...
by: wuzertheloser | last post by:
A mathematical relationship between x and y is described by the following expressions: y= A*x^3-B*x+3/4 if x<=0 (Case 1) y=1-B-C*x^4 if 0<x<1 (Case 2) y=A*log10(x)+B/x ...
by: gdarian216 | last post by:
I am writing a multifile program and it worked when it was all in one file. I have gotten all of the errors out of the program except when I go to output the change the quarters are right but the...
by: zaidalin79 | last post by:
I have a java class that goes for another week or so, and I am going to fail if I can't figure out this simple program. I can't get anything to compile to at least get a few points... Here are the...
by: Netaro | last post by:
Well... So, i have a program. A normal program, which does something, and so.. and i have another program, which wants to run the first program.... So, there are 2 questions about that problem...
by: =?ISO-8859-1?Q?Andr=E9?= | last post by:
Hi everyone, I'd be interested in hearing suggestions as to the "best" way to drive a Python program step by step from another application. Details: --------- I have implemented a "Robot"...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.