To answer your question* below, here is an example that may clarify what I am 
asking.
Example:
I have a 'vector source' of 63 floating point numbers, [1.2,  4.5, 2.3, 8.1 
...], that is outputting one floating point point number. It sends out  one 
number at each sample time (Can I assume one sample at a time i.e. it only 
sends 1 32bit number at a time). If I create a python block that takes the 
input value. I want a "work" function that can calculate the average of the 
current input value and 5 previous inputs. I have these questions:
Questions:1) How do I save the previous values in "memory" that are used to 
generate the new average? 
    A) Does/can the python module store old previous values? If so how?
    B) How much delay does the the python code cause? i.e If I have the 
original data and "delay" data and plot them on a time sync are the aligned?    
C) Can the output of the python block ever send data back to an another block 
that was in the signal path before it, i.e. feedbackThanks...Tom



*Ref: 
> Does it work on each sample or can you send it an array? Is the Python in/out 
> synchronized with the data stream?
 
It's not clear what you mean here. "the data stream" is what you're processing 
here.
 
 
Cheers,
 
Marcus
 
 

 




    On Sunday, August 20, 2023 at 08:16:23 PM CDT, SHAKTHIVEL S 2021 Batch,PES 
University <pes1ug20ec...@pesu.pes.edu> wrote:  
 
 Hi Marcus,I got small doubt after looking at your reply, the self.consume 
takes (inputport , len(in0)) as arguments but the input length depends on the 
number of output_items / input_items as in0 = 
input_items[0][:len(output_items[0])] which  inturn depends on the 
noutput_items / ninput_items variable , right? My doubt is ,aren't the below 
functions in top_block.py define the default length of input vectors / value of 
ninput_items?
 def start(self, max_noutput_items=10000000):
        """
        Start the flowgraph with the given number of output items and return.
        """
        top_block_start_unlocked(self._impl, max_noutput_items)

    def stop(self):
        """
        Stop the flowgraph
        """
        top_block_stop_unlocked(self._impl)

    def run(self, max_noutput_items=10000000):
        """
        Start the flowgraph with the given number of output items and wait.
        """
        self.start(max_noutput_items)
        self.wait()
Thanks and regardsShakti

On Sun, Aug 20, 2023 at 4:02 PM Marcus Müller <marcus.muel...@ettus.com> wrote:

  
Hi Shakti, hi Tom,
 
first off: a friendly reminder to **not** forget to change the subject line 
when replying to digest emails, see the sentence you literally replied to:
 
 

 When replying, please edit your Subject line so it is more specific
  than "Re: Contents of Discuss-gnuradio digest..."
 

 
Anyways, what Shakti recommends makes not too much sense, sorry! All the files 
are "exported from wiki", in other words, the original version is in the very 
wiki with the tutorials in it. That's why it says that in the file name :)
 
https://wiki.gnuradio.org/index.php?title=Usage_Manual
 
 
To address Tom's questions:
 
> If I use the "input" to the block, how many samples are processed each time 
> the Python code is called? 
 
 
As many as you process. That's up to your code! In a general block, you need to 
call `self.consume` (or `consume_each`) yourself to tell the runtime how much 
of the available input you consumed.
 
You need to return the number of samples you have produced at the end of your 
(`general_`) work method. 
 
 
In the sync block (and fixed-rate decimator and interpolators), what you return 
inherently defines how much you consumed, so don't call `consume` or 
`consume_each` in that case.
 
> Does it pass a byte, float, complex, vector, etc... on at a time? 
 
 
No, but that's really clearly illustrated in the Python tutorial! 
Seehttps://wiki.gnuradio.org/index.php?title=Creating_Your_First_Block#Editing_Work_Function
 : As you can see, `input_items` is a vector of vectors, each row containing 
the input items from one of the input ports your block has, and then each 
vector there is many items.
 
 
> Does it work on each sample or can you send it an array? Is the Python in/out 
> synchronized with the data stream?
 
It's not clear what you mean here. "the data stream" is what you're processing 
here.
 
 
Cheers,
 
Marcus
 
 

 
 On 20.08.23 05:03, SHAKTHIVEL S 2021 Batch,PES University wrote:
  
 Hi,  You may check in the docs folder in the GitHub page under usage-manual, 
Handling flowgraphs.txt and types of blocks.txt files until someone who is 
expert answer your questions.  Hope that helps.  Thanks..  Shakti  
  On Sun, Aug 20, 2023, 04:54 tom sutherland <alphatoz...@yahoo.com> wrote:
  
   I've gone through the Python tutorial but have some questions. If I use the 
"input" to the block, how many samples are processed each time the Python code 
is called? Does it pass a byte, float, complex, vector, etc... on at a time? 
Does it work on each sample or can you send it an array? Is the Python in/out 
synchronized with the data stream? Thanks...Tom
  
      On Friday, August 18, 2023 at 11:03:02 AM CDT, 
discuss-gnuradio-requ...@gnu.org <discuss-gnuradio-requ...@gnu.org> wrote:  
  
   Send Discuss-gnuradio mailing list submissions to
      discuss-gnuradio@gnu.org
  
  To subscribe or unsubscribe via the World Wide Web, visit
      https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
  or, via email, send a message with subject or body 'help' to
      discuss-gnuradio-requ...@gnu.org
  
  You can reach the person managing the list at
      discuss-gnuradio-ow...@gnu.org
  
  When replying, please edit your Subject line so it is more specific
  than "Re: Contents of Discuss-gnuradio digest..."
  
  
  Today's Topics:
  
    1. [GRCon'23] Keynotes, Workshops, Sponsors: It's all coming
        together! (Marcus Müller)
    2. Re: Using a signal as a parameter in a block? (Marcus Müller)
    3. Re: Discuss-gnuradio Digest, Vol 250, Issue 15 (Sowji Srinithi)
    4. LookupError: KeyError: No devices found (was: Re:
        Discuss-gnuradio Digest, Vol 250, Issue 15) (Marcus Müller)
  
  
  ----------------------------------------------------------------------
  
  Message: 1
  Date: Thu, 17 Aug 2023 18:04:52 +0200
  From: Marcus Müller <mmuel...@gnuradio.org>
  To: Gnuradio Mailing List <discuss-gnuradio@gnu.org>
  Cc: srsran-us...@lists.srsran.com
  Subject: [GRCon'23] Keynotes, Workshops, Sponsors: It's all coming
      together!
  Message-ID: <3cc7fed1-4a23-d428-a16c-4670e01d3...@gnuradio.org>
  Content-Type: text/plain; charset=UTF-8; format=flowed
  
  Dear Community,
  
  GNU Radio Conference 2023 is coming closer! (It takes place starting 
  Sep. 5 in Tempe, Arizona, USA. Tickets happen to be $100 cheaper until 
  2023-08-18 [0].)
  
  == Keynotes ==
  
  The Conference Organizers are quite happy to see an excellent list of 
  Keynote speakers[1] come together for the four conference days:
  
  With Lindy Elkins-Tanton, we have been able to secure the NASA Principal 
  Investigator for the Psyche Mission, and an all-around impressive 
  scientist and research leader on the formation of rocky planets. If 
  being elected into the National Academy of Sciences is not enough 
  credit: there's an asteroid named after her.
  On the technical and historical side, I'm personally looking forward to 
  seeing Eric Blossom again: he, as the first head of architecture, has 
  been formative to the things that make GNU Radio what it is. Currently, 
  he's working on high-speed satellite radios.
  Don't forget that SDR involves, famously, not only software, but also 
  radio. Constantine Balanis' contributions to the field of radio 
  technology are not limited to his authorship of the standard textbook on 
  antennas – he's been at the forefront of EM simulation and RF channel 
  theory and thus set many cornerstones for wireless communications and 
  sensing applications everywhere.
  Of course, if we invite GNU Radio's history, we should also be inviting 
  someone working on the future of GNU Radio: That'd be Ralph Steinhagen, 
  head developer for systems integration at FAIR, one of the largest and 
  technically most advanced particle accelerators, who, together with his 
  team, is putting in all the work to bring a shared vision of GNU Radio 
  4.0 to life.
  
  == Workshops ==
  
  But the value of a conference is not found exclusively in the 
  higher-profile talks, but also in the ways that it enables people to 
  actually have a closer look at things, together. Workshops [2] have been 
  a staple of GRCon's popularity for years, and this year is no exception 
  with a total count of 10 workshops, covering topics from basic DSP, over 
  GNU Radio use, transceiver design, embedded Linux-based SDR development, 
  and FPGA usage on SDR devices, to FOSS 5G network setup with srsRAN.
  
  == Sponsors ==
  
  As you might guess, organizing all this takes effort – and executing 
  takes a lot of funds. Hence, we're very glad we've found sponsors [3] 
  for this year's GRCon. Next to a few industry-standard names, it's 
  especially nice to see breakthrough startups and research organizations 
  take up the chance to present themselves to the GNU Radio audience. You 
  can, when buying tickets [0], directly choose a Patron Ticket, which 
  gives you a cheap opportunity to place your logo on the GRCon website; 
  if that's what you want to do, or if you care for other sponsorship 
  packages, don't hesitate to reach out to spon...@gnuradio.org.
  
  So, for now: I'm looking forward to seeing you there!
  
  -- Marcus
  
  [0] https://tickets.gnuradio.org/
  [1] https://events.gnuradio.org/event/21/page/111-keynote-speakers
  [2] 
  
https://events.gnuradio.org/event/21/contributions/?config=9e736ba3-8af2-4446-b8ba-bf634ad0ff33
  [3] https://events.gnuradio.org/event/21/page/94-our-sponsors
  
  
  
  
  ------------------------------
  
  Message: 2
  Date: Thu, 17 Aug 2023 20:08:51 +0200
  From: Marcus Müller <mmuel...@gnuradio.org>
  To: discuss-gnuradio@gnu.org
  Subject: Re: Using a signal as a parameter in a block?
  Message-ID: <41d0ac35-16ce-dff0-5eb7-7d0b4202c...@gnuradio.org>
  Content-Type: text/plain; charset=UTF-8; format=flowed
  
  Hi Tom,
  
  You are assuming the "delay" input of the Delay block was sample-synchronous 
– it's not!
  Messages are asynchronous to samples by design. Repeating the same message 
hence doesn't 
  do what you want:
  What you're trying to do, keep the delay constant for 1023 samples, then 
change it, keep 
  it constant… but that would require that the delay block "waits" for a new 
message for 
  every sample it processes. It doesn't (and it can't).
  
  I think in your situation, learning how to write a Python (or C++, if that's 
easier for 
  you) block to do in one place what you want to happen here would be the only 
solution – 
  and not too hard.
  
  Best regards,
  Marcus
  
  On 17.08.23 14:59, tom sutherland wrote:
  > I want to use the output value of a signal generator as the delay value of 
a delay block. 
  > Is there a way to pass the output of a signal generator(saw tooth) to the 
delay block? I 
  > have attached an initial grc file and a picture of what I want to do. Any 
help would be 
  > appreciated.
  > Thanks...Tom
  > PS Do you know if I need to sign up for any workshops, etc.. at the 
GNURadio Conference 
  > next month or do I just show up and take a seat? I've already registered.
  > 
  > Inline image
  > 
  > 
  
  
  
  ------------------------------
  
  Message: 3
  Date: Fri, 18 Aug 2023 13:41:16 +0530
  From: Sowji Srinithi <sowjisrini...@gmail.com>
  To: discuss-gnuradio@gnu.org
  Subject: Re: Discuss-gnuradio Digest, Vol 250, Issue 15
  Message-ID:
      <cacqfbd8kfj2dptehwrlg-yec+b3uavdg-tmryyqpmyq6rj+...@mail.gmail.com>
  Content-Type: text/plain; charset="utf-8"
  
  Qt GUI: Could not restore geometry: restoreGeometry(self, geometry:
  Union[QByteArray, bytes, bytearray]): argument 1 has unexpected type
  'NoneType' [INFO] [UHD] linux; GNU C++ version 12.3.0; Boost_107400;
  UHD_4.4.0.0+ds1-4 Traceback (most recent call last): File
  "/home/sowjanya/Downloads/fm_example.py", line 238, in <module> main() File
  "/home/sowjanya/Downloads/fm_example.py", line 216, in main tb =
  top_block_cls() ^^^^^^^^^^^^^^^ File
  "/home/sowjanya/Downloads/fm_example.py", line 84, in __init__
  self.uhd_usrp_source_0 = uhd.usrp_source( ^^^^^^^^^^^^^^^^ RuntimeError:
  LookupError: KeyError: No devices found for -----> Empty Device Address how
  to fix this error
  
  How to fix the above error
  
  On Thu, 17 Aug 2023 at 21:37, <discuss-gnuradio-requ...@gnu.org> wrote:
  
  > Send Discuss-gnuradio mailing list submissions to
  >        discuss-gnuradio@gnu.org
  >
  > To subscribe or unsubscribe via the World Wide Web, visit
  >        https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
  > or, via email, send a message with subject or body 'help' to
  >        discuss-gnuradio-requ...@gnu.org
  >
  > You can reach the person managing the list at
  >        discuss-gnuradio-ow...@gnu.org
  >
  > When replying, please edit your Subject line so it is more specific
  > than "Re: Contents of Discuss-gnuradio digest..."
  >
  >
  > Today's Topics:
  >
  >    1. Using a signal as a parameter in a block? (tom sutherland)
  >
  >
  > ----------------------------------------------------------------------
  >
  > Message: 1
  > Date: Thu, 17 Aug 2023 12:59:58 +0000 (UTC)
  > From: tom sutherland <alphatoz...@yahoo.com>
  > To: "discuss-gnuradio@gnu.org" <discuss-gnuradio@gnu.org>
  > Subject: Using a signal as a parameter in a block?
  > Message-ID: <661605185.819399.1692277198...@mail.yahoo.com>
  > Content-Type: text/plain; charset="utf-8"
  >
  > I want to use the output value of a signal generator as the delay value of
  > a delay block. Is there a way to pass the output of a signal generator(saw
  > tooth) to the delay block? I have attached an initial grc file and a
  > picture of what I want to do. Any help would be appreciated.Thanks...TomPS
  > Do you know if I need to sign up for any workshops, etc.. at the GNURadio
  > Conference next month or do I just show up and take a seat? I've already
  > registered.
  >
  >
  >
  >
  > -------------- next part --------------
  > An HTML attachment was scrubbed...
  > URL: <
  > 
https://lists.gnu.org/archive/html/discuss-gnuradio/attachments/20230817/353462d6/attachment.htm
  > >
  > -------------- next part --------------
  > A non-text attachment was scrubbed...
  > Name: 1692277050668blob.jpg
  > Type: image/png
  > Size: 41672 bytes
  > Desc: not available
  > URL: <
  > 
https://lists.gnu.org/archive/html/discuss-gnuradio/attachments/20230817/353462d6/attachment.png
  > >
  > -------------- next part --------------
  > A non-text attachment was scrubbed...
  > Name: rampAsDelayInput.grc
  > Type: application/octet-stream
  > Size: 4072 bytes
  > Desc: not available
  > URL: <
  > 
https://lists.gnu.org/archive/html/discuss-gnuradio/attachments/20230817/353462d6/attachment.obj
  > >
  > -------------- next part --------------
  > A non-text attachment was scrubbed...
  > Name: RampAsDelayInput.png
  > Type: image/png
  > Size: 30385 bytes
  > Desc: not available
  > URL: <
  > 
https://lists.gnu.org/archive/html/discuss-gnuradio/attachments/20230817/353462d6/attachment-0001.png
  > >
  >
  > ------------------------------
  >
  > Subject: Digest Footer
  >
  > _______________________________________________
  > Discuss-gnuradio mailing list
  > Discuss-gnuradio@gnu.org
  > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
  >
  >
  > ------------------------------
  >
  > End of Discuss-gnuradio Digest, Vol 250, Issue 15
  > *************************************************
  >
  -------------- next part --------------
  An HTML attachment was scrubbed...
  URL: 
<https://lists.gnu.org/archive/html/discuss-gnuradio/attachments/20230818/70cc2c07/attachment.htm>
  
  ------------------------------
  
  Message: 4
  Date: Fri, 18 Aug 2023 10:35:09 +0200
  From: Marcus Müller <marcus.muel...@ettus.com>
  To: discuss-gnuradio@gnu.org
  Subject: LookupError: KeyError: No devices found (was: Re:
      Discuss-gnuradio Digest, Vol 250, Issue 15)
  Message-ID: <4b8dc553-f663-4d9b-fdbf-beca6b3ee...@ettus.com>
  Content-Type: text/plain; charset="utf-8"; Format="flowed"
  
  Hi Sowji,
  
  according to the text you've replied to:
  
  > When replying, please edit your Subject line so it is more specific
  > than "Re: Contents of Discuss-gnuradio digest..."
  
  I changed the subject line to actually describe the contents of your email. 
Please get in 
  the habit of doing that :)
  
  Anyways, as you notice, this is an error related to UHD not finding any USRP 
devices. 
  Since we don't know which device you have, we can't help you with that. But 
to expedite a 
  solution: Guides to this are found in dozens of corners on the internet, for 
example
  
https://stackoverflow.com/questions/33304828/when-trying-to-use-my-usrp-in-gnu-radio-i-get-a-no-devices-found-for
 
  
  
  Best,
  
  Marcus
  
  
  On 18.08.23 10:11, Sowji Srinithi wrote:
  > Qt GUI: Could not restore geometry: restoreGeometry(self, geometry: 
Union[QByteArray, 
  > bytes, bytearray]): argument 1 has unexpected type 'NoneType' [INFO] [UHD] 
linux; GNU 
  > C++ version 12.3.0; Boost_107400; UHD_4.4.0.0+ds1-4 Traceback (most recent 
call last): 
  > File "/home/sowjanya/Downloads/fm_example.py", line 238, in <module> main() 
File 
  > "/home/sowjanya/Downloads/fm_example.py", line 216, in main tb = 
top_block_cls() 
  > ^^^^^^^^^^^^^^^ File "/home/sowjanya/Downloads/fm_example.py", line 84, in 
__init__ 
  > self.uhd_usrp_source_0 = uhd.usrp_source( ^^^^^^^^^^^^^^^^ RuntimeError: 
LookupError: 
  > KeyError: No devices found for -----> Empty Device Address how to fix this 
error
  >
  > How to fix the above error
  >
  > On Thu, 17 Aug 2023 at 21:37, <discuss-gnuradio-requ...@gnu.org> wrote:
  >
  >    Send Discuss-gnuradio mailing list submissions to
  >    discuss-gnuradio@gnu.org
  >
  >    To subscribe or unsubscribe via the World Wide Web, visit
  >    https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
  >    or, via email, send a message with subject or body 'help' to
  >    discuss-gnuradio-requ...@gnu.org
  >
  >    You can reach the person managing the list at
  >    discuss-gnuradio-ow...@gnu.org
  >
  >    When replying, please edit your Subject line so it is more specific
  >    than "Re: Contents of Discuss-gnuradio digest..."
  >
  >
  >    Today's Topics:
  >
  >       1. Using a signal as a parameter in a block? (tom sutherland)
  >
  >
  >    ----------------------------------------------------------------------
  >
  >    Message: 1
  >    Date: Thu, 17 Aug 2023 12:59:58 +0000 (UTC)
  >    From: tom sutherland <alphatoz...@yahoo.com>
  >    To: "discuss-gnuradio@gnu.org" <discuss-gnuradio@gnu.org>
  >    Subject: Using a signal as a parameter in a block?
  >    Message-ID: <661605185.819399.1692277198...@mail.yahoo.com>
  >    Content-Type: text/plain; charset="utf-8"
  >
  >    I want to use the output value of a signal generator as the delay value 
of a delay
  >    block. Is there a way to pass the output of a signal generator(saw 
tooth) to the
  >    delay block? I have attached an initial grc file and a picture of what I 
want to do.
  >    Any help would be appreciated.Thanks...TomPS Do you know if I need to 
sign up for
  >    any workshops, etc.. at the GNURadio Conference next month or do I just 
show up and
  >    take a seat? I've already registered.
  >
  >
  >
  >
  >    -------------- next part --------------
  >    An HTML attachment was scrubbed...
  >    URL:
  >    
<https://lists.gnu.org/archive/html/discuss-gnuradio/attachments/20230817/353462d6/attachment.htm>
  >    -------------- next part --------------
  >    A non-text attachment was scrubbed...
  >    Name: 1692277050668blob.jpg
  >    Type: image/png
  >    Size: 41672 bytes
  >    Desc: not available
  >    URL:
  >    
<https://lists.gnu.org/archive/html/discuss-gnuradio/attachments/20230817/353462d6/attachment.png>
  >    -------------- next part --------------
  >    A non-text attachment was scrubbed...
  >    Name: rampAsDelayInput.grc
  >    Type: application/octet-stream
  >    Size: 4072 bytes
  >    Desc: not available
  >    URL:
  >    
<https://lists.gnu.org/archive/html/discuss-gnuradio/attachments/20230817/353462d6/attachment.obj>
  >    -------------- next part --------------
  >    A non-text attachment was scrubbed...
  >    Name: RampAsDelayInput.png
  >    Type: image/png
  >    Size: 30385 bytes
  >    Desc: not available
  >    URL:
  >    
<https://lists.gnu.org/archive/html/discuss-gnuradio/attachments/20230817/353462d6/attachment-0001.png>
  >
  >    ------------------------------
  >
  >    Subject: Digest Footer
  >
  >    _______________________________________________
  >    Discuss-gnuradio mailing list
  >    Discuss-gnuradio@gnu.org
  >    https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
  >
  >
  >    ------------------------------
  >
  >    End of Discuss-gnuradio Digest, Vol 250, Issue 15
  >    *************************************************
  >
  -------------- next part --------------
  An HTML attachment was scrubbed...
  URL: 
<https://lists.gnu.org/archive/html/discuss-gnuradio/attachments/20230818/b6b52e2b/attachment.htm>
  
  ------------------------------
  
  Subject: Digest Footer
  
  _______________________________________________
  Discuss-gnuradio mailing list
  Discuss-gnuradio@gnu.org
  https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
  
  
  ------------------------------
  
  End of Discuss-gnuradio Digest, Vol 250, Issue 16
  *************************************************
      
  
 
  

Reply via email to