473,725 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

1 program into another

9 New Member
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



PROGRAM A

#!/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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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_util s
from gnuradio import usrp
from gnuradio import eng_notation
from gnuradio.eng_op tion 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('Att ach and press enter')


class my_graph(gr.flo w_graph):
def __init__(self, modulator_class , options):
gr.flow_graph._ _init__(self)
self.txpath = transmit_path(s elf, modulator_class , options)


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

def main():

def send_pkt(payloa d='', eof=False):
return fg.txpath.send_ pkt(payload, eof)

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

mods = modulation_util s.type_1_mods()

parser = OptionParser(op tion_class=eng_ option, conflict_handle r="resolve")
expert_grp = parser.add_opti on_group("Exper t")

parser.add_opti on("-m", "--modulation", type="choice", choices=mods.ke ys(),
default='gmsk',
help="Select modulation from: %s [default=%%defau lt]"
% (', '.join(mods.key s()),))

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

transmit_path.a dd_options(pars er, expert_grp)

for mod in mods.values():
mod.add_options (expert_grp)

fusb_options.ad d_options(exper t_grp)
(options, args) = parser.parse_ar gs ()

if len(args) != 0:
parser.print_he lp()
sys.exit(1)

if options.tx_freq is None:
sys.stderr.writ e("You must specify -f FREQ or --freq FREQ\n")
parser.print_he lp(sys.stderr)
sys.exit(1)

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

r = gr.enable_realt ime_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.megabyt es)
n = 0
pktno = 0
pkt_size = int(options.siz e)

while n < nbytes:
send_pkt(struct .pack('!H', pktno) + (pkt_size - 2) * chr(pktno & 0xff))
n += pkt_size
sys.stderr.writ e('.')
if options.discont inuous and pktno % 5 == 4:
time.sleep(1)
pktno += 1

send_pkt(eof=Tr ue)
fg.wait() # wait for it to finish

if __name__ == '__main__':
try:
main()
except KeyboardInterru pt:
pass






PROGRAM B


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.ke ys())
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 1383

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

Similar topics

17
4006
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 sleep for 1 second after indexing a couple of files. I'm wondering if anyone knows of a way that I could make so that the program will run at full speed only runs after the computer has been idle for a while. I've looked at the "nice" command...
22
3603
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 Newsgroup Readers: If you circulate copies of this report to groups of computer programmers at different universities etc. around the world then they might find the subject matter to be interesting.
2
7497
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 """f:\phsData\htmldoc\htmldoc.exe"" --webpage -f phsnew.pdf phsnew.htm" program either doesn't get invoked, or has an error, but since it has no error log i can't check that,
11
2605
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 >> Fork(MyProgram3, SomeFile); If not would this be something of interest to others? Thanks in advance,
6
2784
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 having trouble doing it all without using global variables though, so I have another post in this group about local variable usage and how to pass it, but just when I thought I'd got it, my program has a segmentation fault. I'm not exactly sure...
7
4789
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 if x>=1 (Case 3) where A, B, and C are constants. Write a C program that reads
1
1531
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 dimes and pennies print out a long string of numbers. I can't figure out were these numbers are coming from. If anyone can help I will be appreciated. This is my main.cpp code for the body of my program. #include<iostream> #include"vendlib.h"...
109
25841
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 assignments... 4. CheckPoint: Inventory Program Part 1 • Resource: Java: How to Program • Due Date: Day 5 forum • Choose a product that lends itself to an inventory (for example, products at your workplace, office supplies, music CDs, DVD...
1
1804
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 -> 1) How can i run the program using another program? Is there anything like runProgram(Directory,Name.exe)? 2) Programs usually returns the 0 value when they end. So, can i, for example, put something like int main(){ int something; //do...
1
2013
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" that can be programmed by a user to perform certain actions. (see Reeborg below for a simple javascript-
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.